@codluv/versionguard 0.2.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/calver.d.ts +65 -22
- package/dist/calver.d.ts.map +1 -1
- package/dist/chunks/{index-BwE_OaV3.js → index-B3R60bYJ.js} +913 -138
- package/dist/chunks/index-B3R60bYJ.js.map +1 -0
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +258 -22
- package/dist/cli.js.map +1 -1
- package/dist/config.d.ts.map +1 -1
- package/dist/feedback/index.d.ts +1 -1
- package/dist/feedback/index.d.ts.map +1 -1
- package/dist/fix/index.d.ts +7 -2
- package/dist/fix/index.d.ts.map +1 -1
- package/dist/guard.d.ts +45 -1
- package/dist/guard.d.ts.map +1 -1
- package/dist/hooks.d.ts.map +1 -1
- package/dist/index.d.ts +3 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +33 -23
- package/dist/init-wizard.d.ts +49 -0
- package/dist/init-wizard.d.ts.map +1 -0
- package/dist/project.d.ts +54 -10
- package/dist/project.d.ts.map +1 -1
- package/dist/sources/git-tag.d.ts +52 -0
- package/dist/sources/git-tag.d.ts.map +1 -0
- package/dist/sources/index.d.ts +15 -0
- package/dist/sources/index.d.ts.map +1 -0
- package/dist/sources/json.d.ts +53 -0
- package/dist/sources/json.d.ts.map +1 -0
- package/dist/sources/provider.d.ts +25 -0
- package/dist/sources/provider.d.ts.map +1 -0
- package/dist/sources/regex.d.ts +56 -0
- package/dist/sources/regex.d.ts.map +1 -0
- package/dist/sources/resolve.d.ts +54 -0
- package/dist/sources/resolve.d.ts.map +1 -0
- package/dist/sources/toml.d.ts +60 -0
- package/dist/sources/toml.d.ts.map +1 -0
- package/dist/sources/utils.d.ts +73 -0
- package/dist/sources/utils.d.ts.map +1 -0
- package/dist/sources/version-file.d.ts +51 -0
- package/dist/sources/version-file.d.ts.map +1 -0
- package/dist/sources/yaml.d.ts +53 -0
- package/dist/sources/yaml.d.ts.map +1 -0
- package/dist/tag/index.d.ts.map +1 -1
- package/dist/types.d.ts +138 -5
- package/dist/types.d.ts.map +1 -1
- package/package.json +4 -2
- package/dist/chunks/index-BwE_OaV3.js.map +0 -1
package/dist/cli.js
CHANGED
|
@@ -4,7 +4,219 @@ import * as path from "node:path";
|
|
|
4
4
|
import { fileURLToPath } from "node:url";
|
|
5
5
|
import chalk from "chalk";
|
|
6
6
|
import { Command } from "commander";
|
|
7
|
-
import { i as
|
|
7
|
+
import { i as isValidCalVerFormat, g as getConfig, a as installHooks, b as getPackageVersion, c as getVersionFeedback, v as validate, h as handlePostTag, r as runGuardChecks, d as getSyncFeedback, e as getChangelogFeedback, f as doctor, j as fixAll, k as fixSyncIssues, s as suggestNextVersion, l as setPackageVersion, m as createTag, u as uninstallHooks, n as areHooksInstalled } from "./chunks/index-B3R60bYJ.js";
|
|
8
|
+
import * as p from "@clack/prompts";
|
|
9
|
+
import * as yaml from "js-yaml";
|
|
10
|
+
async function runWizard(cwd) {
|
|
11
|
+
p.intro("VersionGuard Setup");
|
|
12
|
+
const existingConfig = findExistingConfig(cwd);
|
|
13
|
+
if (existingConfig) {
|
|
14
|
+
p.log.warning(`Config already exists: ${path.relative(cwd, existingConfig)}`);
|
|
15
|
+
const overwrite = await p.confirm({ message: "Overwrite existing config?" });
|
|
16
|
+
if (p.isCancel(overwrite) || !overwrite) {
|
|
17
|
+
p.outro("Setup cancelled.");
|
|
18
|
+
return null;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
const type = await p.select({
|
|
22
|
+
message: "Versioning strategy",
|
|
23
|
+
options: [
|
|
24
|
+
{ value: "semver", label: "SemVer", hint: "MAJOR.MINOR.PATCH (e.g., 1.2.3)" },
|
|
25
|
+
{ value: "calver", label: "CalVer", hint: "Calendar-based (e.g., 2026.3.0)" }
|
|
26
|
+
]
|
|
27
|
+
});
|
|
28
|
+
if (p.isCancel(type)) {
|
|
29
|
+
p.outro("Setup cancelled.");
|
|
30
|
+
return null;
|
|
31
|
+
}
|
|
32
|
+
let format;
|
|
33
|
+
if (type === "calver") {
|
|
34
|
+
const selected = await selectCalVerFormat();
|
|
35
|
+
if (!selected) {
|
|
36
|
+
p.outro("Setup cancelled.");
|
|
37
|
+
return null;
|
|
38
|
+
}
|
|
39
|
+
format = selected;
|
|
40
|
+
}
|
|
41
|
+
const manifest = await selectManifest(cwd);
|
|
42
|
+
if (manifest === null) {
|
|
43
|
+
p.outro("Setup cancelled.");
|
|
44
|
+
return null;
|
|
45
|
+
}
|
|
46
|
+
const hooks = await p.confirm({
|
|
47
|
+
message: "Install git hooks? (pre-commit, pre-push, post-tag)",
|
|
48
|
+
initialValue: true
|
|
49
|
+
});
|
|
50
|
+
if (p.isCancel(hooks)) {
|
|
51
|
+
p.outro("Setup cancelled.");
|
|
52
|
+
return null;
|
|
53
|
+
}
|
|
54
|
+
const changelog = await p.confirm({
|
|
55
|
+
message: "Enable changelog validation?",
|
|
56
|
+
initialValue: true
|
|
57
|
+
});
|
|
58
|
+
if (p.isCancel(changelog)) {
|
|
59
|
+
p.outro("Setup cancelled.");
|
|
60
|
+
return null;
|
|
61
|
+
}
|
|
62
|
+
const config = buildConfig({
|
|
63
|
+
type,
|
|
64
|
+
format,
|
|
65
|
+
manifest: manifest === "auto" ? void 0 : manifest,
|
|
66
|
+
hooks,
|
|
67
|
+
changelog
|
|
68
|
+
});
|
|
69
|
+
const configPath = writeConfig(cwd, config);
|
|
70
|
+
p.log.success(`Created ${path.relative(cwd, configPath)}`);
|
|
71
|
+
p.outro("Run `versionguard validate` to verify your setup.");
|
|
72
|
+
return configPath;
|
|
73
|
+
}
|
|
74
|
+
function runHeadless(options) {
|
|
75
|
+
const existingConfig = findExistingConfig(options.cwd);
|
|
76
|
+
if (existingConfig && !options.yes) {
|
|
77
|
+
throw new Error(`Config already exists: ${existingConfig}. Use --yes to overwrite.`);
|
|
78
|
+
}
|
|
79
|
+
const config = buildConfig({
|
|
80
|
+
type: options.type ?? "semver",
|
|
81
|
+
format: options.format,
|
|
82
|
+
manifest: options.manifest,
|
|
83
|
+
hooks: options.hooks ?? true,
|
|
84
|
+
changelog: options.changelog ?? true
|
|
85
|
+
});
|
|
86
|
+
return writeConfig(options.cwd, config);
|
|
87
|
+
}
|
|
88
|
+
async function selectCalVerFormat() {
|
|
89
|
+
const preset = await p.select({
|
|
90
|
+
message: "CalVer format",
|
|
91
|
+
options: [
|
|
92
|
+
{ value: "YYYY.M.MICRO", label: "YYYY.M.MICRO", hint: "calver.org standard — 2026.3.0" },
|
|
93
|
+
{ value: "YYYY.MM.MICRO", label: "YYYY.MM.MICRO", hint: "padded month — 2026.03.0" },
|
|
94
|
+
{ value: "YY.0M.MICRO", label: "YY.0M.MICRO", hint: "Twisted/pip style — 26.03.0" },
|
|
95
|
+
{ value: "YYYY.0M.0D", label: "YYYY.0M.0D", hint: "date-based — 2026.03.25" },
|
|
96
|
+
{
|
|
97
|
+
value: "YYYY.0M.0D.MICRO",
|
|
98
|
+
label: "YYYY.0M.0D.MICRO",
|
|
99
|
+
hint: "youtube-dl style — 2026.03.25.0"
|
|
100
|
+
},
|
|
101
|
+
{ value: "YY.0M", label: "YY.0M", hint: "Ubuntu style — 26.03" },
|
|
102
|
+
{ value: "custom", label: "Custom...", hint: "enter your own token format" }
|
|
103
|
+
]
|
|
104
|
+
});
|
|
105
|
+
if (p.isCancel(preset)) return null;
|
|
106
|
+
if (preset === "custom") {
|
|
107
|
+
const custom = await p.text({
|
|
108
|
+
message: "Enter CalVer format (dot-separated tokens)",
|
|
109
|
+
placeholder: "YYYY.MM.MICRO",
|
|
110
|
+
validate(value) {
|
|
111
|
+
if (!value || !isValidCalVerFormat(value)) {
|
|
112
|
+
return "Invalid format. Use tokens: YYYY|YY|0Y, MM|M|0M, WW|0W, DD|D|0D, MICRO|PATCH";
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
});
|
|
116
|
+
if (p.isCancel(custom)) return null;
|
|
117
|
+
return custom;
|
|
118
|
+
}
|
|
119
|
+
return preset;
|
|
120
|
+
}
|
|
121
|
+
async function selectManifest(cwd) {
|
|
122
|
+
const detected = [];
|
|
123
|
+
const checks = [
|
|
124
|
+
{ file: "package.json", label: "package.json", hint: "Node.js / Bun" },
|
|
125
|
+
{ file: "Cargo.toml", label: "Cargo.toml", hint: "Rust" },
|
|
126
|
+
{ file: "pyproject.toml", label: "pyproject.toml", hint: "Python" },
|
|
127
|
+
{ file: "pubspec.yaml", label: "pubspec.yaml", hint: "Dart / Flutter" },
|
|
128
|
+
{ file: "composer.json", label: "composer.json", hint: "PHP" },
|
|
129
|
+
{ file: "pom.xml", label: "pom.xml", hint: "Java / Maven" },
|
|
130
|
+
{ file: "VERSION", label: "VERSION", hint: "Plain text file" }
|
|
131
|
+
];
|
|
132
|
+
for (const check of checks) {
|
|
133
|
+
if (fs.existsSync(path.join(cwd, check.file))) {
|
|
134
|
+
detected.push({ value: check.file, label: `${check.label} (detected)`, hint: check.hint });
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
const options = [
|
|
138
|
+
{ value: "auto", label: "Auto-detect", hint: "scan for known manifests at runtime" },
|
|
139
|
+
...detected,
|
|
140
|
+
...checks.filter((c) => !detected.some((d) => d.value === c.file)).map((c) => ({ value: c.file, label: c.label, hint: c.hint })),
|
|
141
|
+
{ value: "git-tag", label: "Git tags", hint: "Go / Swift — version from tags" }
|
|
142
|
+
];
|
|
143
|
+
const result = await p.select({
|
|
144
|
+
message: "Version source",
|
|
145
|
+
options,
|
|
146
|
+
initialValue: detected.length === 1 ? detected[0].value : "auto"
|
|
147
|
+
});
|
|
148
|
+
if (p.isCancel(result)) return null;
|
|
149
|
+
return result;
|
|
150
|
+
}
|
|
151
|
+
function buildConfig(input) {
|
|
152
|
+
const config = {
|
|
153
|
+
versioning: {
|
|
154
|
+
type: input.type,
|
|
155
|
+
...input.type === "calver" && input.format ? {
|
|
156
|
+
calver: {
|
|
157
|
+
format: input.format,
|
|
158
|
+
preventFutureDates: true
|
|
159
|
+
}
|
|
160
|
+
} : {}
|
|
161
|
+
}
|
|
162
|
+
};
|
|
163
|
+
if (input.manifest) {
|
|
164
|
+
config.manifest = { source: input.manifest };
|
|
165
|
+
}
|
|
166
|
+
config.sync = {
|
|
167
|
+
files: ["README.md", "CHANGELOG.md"],
|
|
168
|
+
patterns: [
|
|
169
|
+
{
|
|
170
|
+
regex: `(version\\s*[=:]\\s*["'])(.+?)(["'])`,
|
|
171
|
+
template: "$1{{version}}$3"
|
|
172
|
+
},
|
|
173
|
+
{
|
|
174
|
+
regex: "(##\\s*\\[)(.+?)(\\])",
|
|
175
|
+
template: "$1{{version}}$3"
|
|
176
|
+
}
|
|
177
|
+
]
|
|
178
|
+
};
|
|
179
|
+
config.changelog = {
|
|
180
|
+
enabled: input.changelog,
|
|
181
|
+
file: "CHANGELOG.md",
|
|
182
|
+
strict: true,
|
|
183
|
+
requireEntry: input.changelog
|
|
184
|
+
};
|
|
185
|
+
config.git = {
|
|
186
|
+
hooks: {
|
|
187
|
+
"pre-commit": input.hooks,
|
|
188
|
+
"pre-push": input.hooks,
|
|
189
|
+
"post-tag": input.hooks
|
|
190
|
+
},
|
|
191
|
+
enforceHooks: input.hooks
|
|
192
|
+
};
|
|
193
|
+
config.ignore = ["node_modules/**", "dist/**", ".git/**", "*.lock", ".changeset/**"];
|
|
194
|
+
return config;
|
|
195
|
+
}
|
|
196
|
+
function writeConfig(cwd, config) {
|
|
197
|
+
const configPath = path.join(cwd, ".versionguard.yml");
|
|
198
|
+
const content = yaml.dump(config, {
|
|
199
|
+
indent: 2,
|
|
200
|
+
lineWidth: 120,
|
|
201
|
+
noRefs: true,
|
|
202
|
+
quotingType: '"',
|
|
203
|
+
forceQuotes: false
|
|
204
|
+
});
|
|
205
|
+
fs.writeFileSync(configPath, content, "utf-8");
|
|
206
|
+
return configPath;
|
|
207
|
+
}
|
|
208
|
+
function findExistingConfig(cwd) {
|
|
209
|
+
for (const name of [
|
|
210
|
+
".versionguard.yml",
|
|
211
|
+
".versionguard.yaml",
|
|
212
|
+
"versionguard.yml",
|
|
213
|
+
"versionguard.yaml"
|
|
214
|
+
]) {
|
|
215
|
+
const full = path.join(cwd, name);
|
|
216
|
+
if (fs.existsSync(full)) return full;
|
|
217
|
+
}
|
|
218
|
+
return null;
|
|
219
|
+
}
|
|
8
220
|
const CLI_DIR = path.dirname(fileURLToPath(import.meta.url));
|
|
9
221
|
const CLI_VERSION = JSON.parse(fs.readFileSync(path.join(CLI_DIR, "..", "package.json"), "utf-8")).version;
|
|
10
222
|
const styles = {
|
|
@@ -18,24 +230,48 @@ const styles = {
|
|
|
18
230
|
function createProgram() {
|
|
19
231
|
const program = new Command();
|
|
20
232
|
program.name("versionguard").description("Strict versioning enforcement for SemVer and CalVer").version(CLI_VERSION);
|
|
21
|
-
program.command("init").description("Initialize VersionGuard configuration").option("-c, --cwd <path>", "Working directory", process.cwd()).
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
233
|
+
program.command("init").description("Initialize VersionGuard configuration (interactive wizard or headless)").option("-c, --cwd <path>", "Working directory", process.cwd()).option("-t, --type <type>", "Versioning type: semver or calver").option("-f, --format <format>", "CalVer format tokens (e.g., YYYY.M.MICRO)").option("--manifest <source>", "Manifest source (e.g., Cargo.toml, pyproject.toml, auto)").option("--hooks", "Install git hooks (default: true)").option("--no-hooks", "Skip git hooks").option("--changelog", "Enable changelog validation (default: true)").option("--no-changelog", "Disable changelog validation").option("-y, --yes", "Accept all defaults, no prompts").action(
|
|
234
|
+
async (options) => {
|
|
235
|
+
try {
|
|
236
|
+
const isHeadless = options.yes || options.type || options.format || options.manifest;
|
|
237
|
+
let configPath;
|
|
238
|
+
if (isHeadless) {
|
|
239
|
+
configPath = runHeadless({
|
|
240
|
+
cwd: options.cwd,
|
|
241
|
+
type: options.type,
|
|
242
|
+
format: options.format,
|
|
243
|
+
manifest: options.manifest,
|
|
244
|
+
hooks: options.hooks,
|
|
245
|
+
changelog: options.changelog,
|
|
246
|
+
yes: options.yes
|
|
247
|
+
});
|
|
248
|
+
console.log(styles.success(`✓ Created ${path.relative(options.cwd, configPath)}`));
|
|
249
|
+
} else {
|
|
250
|
+
configPath = await runWizard(options.cwd);
|
|
251
|
+
if (!configPath) {
|
|
252
|
+
process.exit(0);
|
|
253
|
+
return;
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
try {
|
|
257
|
+
const config = getConfig(options.cwd);
|
|
258
|
+
if (config.git.enforceHooks) {
|
|
259
|
+
installHooks(config.git, options.cwd);
|
|
260
|
+
console.log(styles.success("✓ Git hooks installed"));
|
|
261
|
+
}
|
|
262
|
+
} catch {
|
|
263
|
+
console.log(styles.info("ℹ Skipped hooks install (not a git repository)"));
|
|
264
|
+
}
|
|
265
|
+
} catch (error) {
|
|
266
|
+
console.error(styles.error(`✗ ${error.message}`));
|
|
267
|
+
process.exit(1);
|
|
268
|
+
}
|
|
33
269
|
}
|
|
34
|
-
|
|
270
|
+
);
|
|
35
271
|
program.command("check").description("Check the current version with actionable feedback").option("-c, --cwd <path>", "Working directory", process.cwd()).option("--prev <version>", "Previous version for comparison").option("--json", "Print machine-readable JSON output").action((options) => {
|
|
36
272
|
try {
|
|
37
273
|
const config = getConfig(options.cwd);
|
|
38
|
-
const version = getPackageVersion(options.cwd);
|
|
274
|
+
const version = getPackageVersion(options.cwd, config.manifest);
|
|
39
275
|
const result = getVersionFeedback(version, config, options.prev);
|
|
40
276
|
if (options.json) {
|
|
41
277
|
console.log(
|
|
@@ -87,7 +323,7 @@ function createProgram() {
|
|
|
87
323
|
program.command("validate").description("Run full validation with smart feedback").option("-c, --cwd <path>", "Working directory", process.cwd()).option("--hook <name>", "Running as git hook").option("--json", "Print machine-readable JSON output").option("--strict", "Run guard checks and fail on any policy gap or bypass").action((options) => {
|
|
88
324
|
try {
|
|
89
325
|
const config = getConfig(options.cwd);
|
|
90
|
-
const version = getPackageVersion(options.cwd);
|
|
326
|
+
const version = getPackageVersion(options.cwd, config.manifest);
|
|
91
327
|
const result = validate(config, options.cwd);
|
|
92
328
|
let postTagResult;
|
|
93
329
|
let guardReport;
|
|
@@ -229,7 +465,7 @@ function createProgram() {
|
|
|
229
465
|
program.command("fix").description("Auto-fix detected issues").option("-c, --cwd <path>", "Working directory", process.cwd()).action((options) => {
|
|
230
466
|
try {
|
|
231
467
|
const config = getConfig(options.cwd);
|
|
232
|
-
const version = getPackageVersion(options.cwd);
|
|
468
|
+
const version = getPackageVersion(options.cwd, config.manifest);
|
|
233
469
|
const results = fixAll(config, version, options.cwd);
|
|
234
470
|
console.log(styles.bold(`Fixing issues for version ${version}...`));
|
|
235
471
|
console.log("");
|
|
@@ -245,7 +481,7 @@ function createProgram() {
|
|
|
245
481
|
program.command("sync").description("Sync version to all configured files").option("-c, --cwd <path>", "Working directory", process.cwd()).action((options) => {
|
|
246
482
|
try {
|
|
247
483
|
const config = getConfig(options.cwd);
|
|
248
|
-
const version = getPackageVersion(options.cwd);
|
|
484
|
+
const version = getPackageVersion(options.cwd, config.manifest);
|
|
249
485
|
const results = fixSyncIssues(config, options.cwd);
|
|
250
486
|
console.log(styles.bold(`Syncing version ${version}...`));
|
|
251
487
|
for (const result of results) {
|
|
@@ -261,7 +497,7 @@ function createProgram() {
|
|
|
261
497
|
(options) => {
|
|
262
498
|
try {
|
|
263
499
|
const config = getConfig(options.cwd);
|
|
264
|
-
const currentVersion = getPackageVersion(options.cwd);
|
|
500
|
+
const currentVersion = getPackageVersion(options.cwd, config.manifest);
|
|
265
501
|
const suggestions = suggestNextVersion(currentVersion, config, options.type);
|
|
266
502
|
console.log(styles.bold(`Current version: ${currentVersion}`));
|
|
267
503
|
console.log("");
|
|
@@ -274,7 +510,7 @@ function createProgram() {
|
|
|
274
510
|
if (!nextVersion) {
|
|
275
511
|
throw new Error("No version suggestion available");
|
|
276
512
|
}
|
|
277
|
-
setPackageVersion(nextVersion, options.cwd);
|
|
513
|
+
setPackageVersion(nextVersion, options.cwd, config.manifest);
|
|
278
514
|
fixAll(config, nextVersion, options.cwd);
|
|
279
515
|
console.log(styles.success(`✓ Updated to ${nextVersion}`));
|
|
280
516
|
}
|
|
@@ -284,11 +520,11 @@ function createProgram() {
|
|
|
284
520
|
}
|
|
285
521
|
}
|
|
286
522
|
);
|
|
287
|
-
program.command("tag").description("Create a git tag with automation").argument("[version]", "Version to tag (defaults to
|
|
523
|
+
program.command("tag").description("Create a git tag with automation").argument("[version]", "Version to tag (defaults to manifest version)").option("-c, --cwd <path>", "Working directory", process.cwd()).option("-m, --message <msg>", "Tag message").option("--no-fix", "Skip auto-fixing files before tagging").action(
|
|
288
524
|
(version, options) => {
|
|
289
525
|
try {
|
|
290
526
|
const config = getConfig(options.cwd);
|
|
291
|
-
const tagVersion = version || getPackageVersion(options.cwd);
|
|
527
|
+
const tagVersion = version || getPackageVersion(options.cwd, config.manifest);
|
|
292
528
|
const result = createTag(
|
|
293
529
|
tagVersion,
|
|
294
530
|
options.message,
|
package/dist/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","sources":["../src/cli.ts"],"sourcesContent":["#!/usr/bin/env node\nimport * as fs from 'node:fs';\nimport * as path from 'node:path';\nimport { fileURLToPath } from 'node:url';\n\nimport chalk from 'chalk';\nimport { Command } from 'commander';\n\nconst CLI_DIR = path.dirname(fileURLToPath(import.meta.url));\nconst CLI_VERSION: string = (\n JSON.parse(fs.readFileSync(path.join(CLI_DIR, '..', 'package.json'), 'utf-8')) as {\n version: string;\n }\n).version;\n\nimport * as feedback from './feedback';\nimport * as fix from './fix';\nimport * as guard from './guard';\nimport * as versionguard from './index';\nimport * as project from './project';\nimport * as tag from './tag';\n\nconst styles = {\n error: chalk.red,\n warning: chalk.yellow,\n success: chalk.green,\n info: chalk.blue,\n dim: chalk.gray,\n bold: chalk.bold,\n};\n\n/**\n * Creates the VersionGuard CLI program definition.\n *\n * @public\n * @since 0.1.0\n * @remarks\n * This function wires all commands, options, and handlers onto a fresh Commander\n * program instance without parsing arguments yet.\n *\n * @returns A configured Commander program for the VersionGuard CLI.\n *\n * @example\n * ```typescript\n * const program = createProgram();\n * console.log(program.name());\n * ```\n */\nexport function createProgram(): Command {\n const program = new Command();\n\n program\n .name('versionguard')\n .description('Strict versioning enforcement for SemVer and CalVer')\n .version(CLI_VERSION);\n\n program\n .command('init')\n .description('Initialize VersionGuard configuration')\n .option('-c, --cwd <path>', 'Working directory', process.cwd())\n .action((options: { cwd: string }) => {\n try {\n const configPath = versionguard.initConfig(options.cwd);\n console.log(styles.success(`✓ Created ${path.relative(options.cwd, configPath)}`));\n console.log('');\n console.log(styles.info('Next steps:'));\n console.log(' 1. Edit .versionguard.yml to set your versioning type');\n console.log(' 2. Run: npx versionguard hooks install');\n console.log(' 3. Run: npx versionguard check');\n } catch (error) {\n console.error(styles.error(`✗ ${(error as Error).message}`));\n process.exit(1);\n }\n });\n\n program\n .command('check')\n .description('Check the current version with actionable feedback')\n .option('-c, --cwd <path>', 'Working directory', process.cwd())\n .option('--prev <version>', 'Previous version for comparison')\n .option('--json', 'Print machine-readable JSON output')\n .action((options: { cwd: string; prev?: string; json?: boolean }) => {\n try {\n const config = versionguard.getConfig(options.cwd);\n const version = versionguard.getPackageVersion(options.cwd);\n const result = feedback.getVersionFeedback(version, config, options.prev);\n\n if (options.json) {\n console.log(\n JSON.stringify(\n {\n version,\n versioningType: config.versioning.type,\n valid: result.valid,\n errors: result.errors,\n suggestions: result.suggestions,\n },\n null,\n 2,\n ),\n );\n if (!result.valid) {\n process.exit(1);\n }\n return;\n }\n\n console.log(styles.bold(`Current version: ${version}`));\n console.log(styles.dim(`Versioning type: ${config.versioning.type}`));\n console.log('');\n\n if (result.valid) {\n console.log(styles.success('✓ Version is valid'));\n return;\n }\n\n console.log(styles.error('✗ Version has issues:'));\n console.log('');\n for (const error of result.errors) {\n console.log(styles.error(` ✗ ${error.message}`));\n }\n if (result.suggestions.length > 0) {\n console.log('');\n console.log(styles.info('How to fix:'));\n for (const suggestion of result.suggestions) {\n console.log(` → ${suggestion.message}`);\n if (suggestion.fix) {\n console.log(styles.dim(` Run: ${suggestion.fix}`));\n }\n }\n }\n process.exit(1);\n } catch (error) {\n console.error(styles.error(`✗ ${(error as Error).message}`));\n process.exit(1);\n }\n });\n\n program\n .command('validate')\n .description('Run full validation with smart feedback')\n .option('-c, --cwd <path>', 'Working directory', process.cwd())\n .option('--hook <name>', 'Running as git hook')\n .option('--json', 'Print machine-readable JSON output')\n .option('--strict', 'Run guard checks and fail on any policy gap or bypass')\n .action((options: { cwd: string; hook?: string; json?: boolean; strict?: boolean }) => {\n try {\n const config = versionguard.getConfig(options.cwd);\n const version = versionguard.getPackageVersion(options.cwd);\n const result = versionguard.validate(config, options.cwd);\n\n let postTagResult: { success: boolean; message: string; actions: string[] } | undefined;\n let guardReport: guard.GuardReport | undefined;\n\n if (options.hook === 'post-tag') {\n postTagResult = tag.handlePostTag(config, options.cwd);\n }\n\n if (options.strict) {\n guardReport = guard.runGuardChecks(config, options.cwd);\n }\n\n if (options.json) {\n console.log(\n JSON.stringify(\n {\n ...result,\n hook: options.hook ?? null,\n postTag: postTagResult ?? null,\n guard: guardReport ?? null,\n },\n null,\n 2,\n ),\n );\n\n if (\n !result.valid ||\n (postTagResult && !postTagResult.success) ||\n (guardReport && !guardReport.safe)\n ) {\n process.exit(1);\n }\n\n return;\n }\n\n console.log(styles.bold(`Validating version ${version}...`));\n console.log('');\n\n if (!result.syncValid) {\n console.log(styles.error('Sync Issues:'));\n for (const error of result.errors.filter((item) => item.includes('mismatch'))) {\n const parts = error.match(\n /Version mismatch in (.+):(\\d+) - found \"(.+?)\" but expected \"(.+?)\"/,\n );\n if (!parts) {\n continue;\n }\n const suggestions = feedback.getSyncFeedback(parts[1], parts[3], parts[4]);\n console.log(styles.error(` ✗ ${parts[1]} has wrong version`));\n console.log(styles.dim(` Found: \"${parts[3]}\" Expected: \"${parts[4]}\"`));\n if (suggestions[0]?.fix) {\n console.log(styles.info(` Fix: ${suggestions[0].fix}`));\n }\n }\n console.log('');\n }\n\n if (config.changelog.enabled && !result.changelogValid) {\n console.log(styles.error('Changelog Issues:'));\n for (const error of result.errors.filter((item) =>\n item.toLowerCase().includes('changelog'),\n )) {\n console.log(styles.error(` ✗ ${error}`));\n }\n const suggestions = feedback.getChangelogFeedback(false, version);\n if (suggestions[0]?.fix) {\n console.log(styles.info(`Fix: ${suggestions[0].fix}`));\n }\n console.log('');\n }\n\n if (postTagResult) {\n if (!postTagResult.success) {\n console.log(styles.error(`✗ ${postTagResult.message}`));\n process.exit(1);\n }\n }\n\n if (guardReport && guardReport.warnings.length > 0) {\n console.log(styles.bold('Guard Checks:'));\n for (const warning of guardReport.warnings) {\n const icon = warning.severity === 'error' ? styles.error('✗') : styles.warning('⚠');\n console.log(` ${icon} [${warning.code}] ${warning.message}`);\n if (warning.fix) {\n console.log(styles.dim(` Fix: ${warning.fix}`));\n }\n }\n console.log('');\n }\n\n if (!result.valid || (guardReport && !guardReport.safe)) {\n console.log(styles.error('✗ Validation failed'));\n process.exit(1);\n }\n\n console.log(styles.success('✓ All validations passed'));\n } catch (error) {\n console.error(styles.error(`✗ ${(error as Error).message}`));\n process.exit(1);\n }\n });\n\n program\n .command('doctor')\n .description('Report repository readiness in one pass')\n .option('-c, --cwd <path>', 'Working directory', process.cwd())\n .option('--json', 'Print machine-readable JSON output')\n .option('--strict', 'Include guard checks for bypass detection')\n .action((options: { cwd: string; json?: boolean; strict?: boolean }) => {\n try {\n const config = versionguard.getConfig(options.cwd);\n const report = versionguard.doctor(config, options.cwd);\n const guardReport = options.strict ? guard.runGuardChecks(config, options.cwd) : undefined;\n\n if (options.json) {\n console.log(JSON.stringify({ ...report, guard: guardReport ?? null }, null, 2));\n if (!report.ready || (guardReport && !guardReport.safe)) {\n process.exit(1);\n }\n return;\n }\n\n console.log(styles.bold('VersionGuard Doctor'));\n console.log(` Version: ${report.version || '(missing)'}`);\n console.log(` Version valid: ${report.versionValid ? 'yes' : 'no'}`);\n console.log(` Files in sync: ${report.syncValid ? 'yes' : 'no'}`);\n console.log(` Changelog ready: ${report.changelogValid ? 'yes' : 'no'}`);\n console.log(` Git repository: ${report.gitRepository ? 'yes' : 'no'}`);\n console.log(\n ` Hooks installed: ${report.gitRepository ? (report.hooksInstalled ? 'yes' : 'no') : 'n/a'}`,\n );\n console.log(\n ` Worktree clean: ${report.gitRepository ? (report.worktreeClean ? 'yes' : 'no') : 'n/a'}`,\n );\n\n if (guardReport) {\n console.log(` Guard safe: ${guardReport.safe ? 'yes' : 'no'}`);\n }\n\n if (!report.ready || (guardReport && !guardReport.safe)) {\n console.log('');\n console.log(styles.error('Issues:'));\n for (const error of report.errors) {\n console.log(styles.error(` ✗ ${error}`));\n }\n if (guardReport) {\n for (const warning of guardReport.warnings) {\n const icon = warning.severity === 'error' ? '✗' : '⚠';\n console.log(styles.error(` ${icon} [${warning.code}] ${warning.message}`));\n if (warning.fix) {\n console.log(styles.dim(` Fix: ${warning.fix}`));\n }\n }\n }\n process.exit(1);\n }\n\n console.log('');\n console.log(styles.success('✓ Repository is ready'));\n } catch (error) {\n console.error(styles.error(`✗ ${(error as Error).message}`));\n process.exit(1);\n }\n });\n\n program\n .command('fix')\n .description('Auto-fix detected issues')\n .option('-c, --cwd <path>', 'Working directory', process.cwd())\n .action((options: { cwd: string }) => {\n try {\n const config = versionguard.getConfig(options.cwd);\n const version = versionguard.getPackageVersion(options.cwd);\n const results = fix.fixAll(config, version, options.cwd);\n\n console.log(styles.bold(`Fixing issues for version ${version}...`));\n console.log('');\n\n for (const result of results) {\n const printer = result.fixed ? styles.success : styles.dim;\n console.log(printer(`${result.fixed ? '✓' : '•'} ${result.message}`));\n }\n } catch (error) {\n console.error(styles.error(`✗ ${(error as Error).message}`));\n process.exit(1);\n }\n });\n\n program\n .command('sync')\n .description('Sync version to all configured files')\n .option('-c, --cwd <path>', 'Working directory', process.cwd())\n .action((options: { cwd: string }) => {\n try {\n const config = versionguard.getConfig(options.cwd);\n const version = versionguard.getPackageVersion(options.cwd);\n const results = fix.fixSyncIssues(config, options.cwd);\n\n console.log(styles.bold(`Syncing version ${version}...`));\n for (const result of results) {\n const printer = result.fixed ? styles.success : styles.dim;\n console.log(printer(`${result.fixed ? '✓' : '•'} ${result.message}`));\n }\n } catch (error) {\n console.error(styles.error(`✗ ${(error as Error).message}`));\n process.exit(1);\n }\n });\n\n program\n .command('bump')\n .description('Suggest and optionally apply the next version')\n .option('-c, --cwd <path>', 'Working directory', process.cwd())\n .option('-t, --type <type>', 'Bump type (major, minor, patch, auto)')\n .option('--apply', 'Apply the first suggested version')\n .action(\n (options: { cwd: string; type?: 'major' | 'minor' | 'patch' | 'auto'; apply?: boolean }) => {\n try {\n const config = versionguard.getConfig(options.cwd);\n const currentVersion = versionguard.getPackageVersion(options.cwd);\n const suggestions = fix.suggestNextVersion(currentVersion, config, options.type);\n\n console.log(styles.bold(`Current version: ${currentVersion}`));\n console.log('');\n for (const [index, suggestion] of suggestions.entries()) {\n console.log(` ${index + 1}. ${styles.bold(suggestion.version)}`);\n console.log(` ${styles.dim(suggestion.reason)}`);\n }\n\n if (options.apply) {\n const nextVersion = suggestions[0]?.version;\n if (!nextVersion) {\n throw new Error('No version suggestion available');\n }\n project.setPackageVersion(nextVersion, options.cwd);\n fix.fixAll(config, nextVersion, options.cwd);\n console.log(styles.success(`✓ Updated to ${nextVersion}`));\n }\n } catch (error) {\n console.error(styles.error(`✗ ${(error as Error).message}`));\n process.exit(1);\n }\n },\n );\n\n program\n .command('tag')\n .description('Create a git tag with automation')\n .argument('[version]', 'Version to tag (defaults to package.json version)')\n .option('-c, --cwd <path>', 'Working directory', process.cwd())\n .option('-m, --message <msg>', 'Tag message')\n .option('--no-fix', 'Skip auto-fixing files before tagging')\n .action(\n (version: string | undefined, options: { cwd: string; message?: string; fix?: boolean }) => {\n try {\n const config = versionguard.getConfig(options.cwd);\n const tagVersion = version || versionguard.getPackageVersion(options.cwd);\n const result = tag.createTag(\n tagVersion,\n options.message,\n options.fix !== false,\n config,\n options.cwd,\n );\n\n if (!result.success) {\n console.log(styles.error(`✗ ${result.message}`));\n process.exit(1);\n }\n\n console.log(styles.success(`✓ ${result.message}`));\n for (const action of result.actions) {\n console.log(` • ${action}`);\n }\n } catch (error) {\n console.error(styles.error(`✗ ${(error as Error).message}`));\n process.exit(1);\n }\n },\n );\n\n const hooksCommand = program.command('hooks').description('Manage git hooks');\n\n hooksCommand\n .command('install')\n .description('Install git hooks')\n .option('-c, --cwd <path>', 'Working directory', process.cwd())\n .action((options: { cwd: string }) => {\n try {\n const config = versionguard.getConfig(options.cwd);\n versionguard.installHooks(config.git, options.cwd);\n console.log(styles.success('✓ Git hooks installed'));\n } catch (error) {\n console.error(styles.error(`✗ ${(error as Error).message}`));\n process.exit(1);\n }\n });\n\n hooksCommand\n .command('uninstall')\n .description('Uninstall git hooks')\n .option('-c, --cwd <path>', 'Working directory', process.cwd())\n .action((options: { cwd: string }) => {\n try {\n versionguard.uninstallHooks(options.cwd);\n console.log(styles.success('✓ Git hooks uninstalled'));\n } catch (error) {\n console.error(styles.error(`✗ ${(error as Error).message}`));\n process.exit(1);\n }\n });\n\n hooksCommand\n .command('status')\n .description('Check if hooks are installed')\n .option('-c, --cwd <path>', 'Working directory', process.cwd())\n .action((options: { cwd: string }) => {\n try {\n if (versionguard.areHooksInstalled(options.cwd)) {\n console.log(styles.success('✓ VersionGuard hooks are installed'));\n return;\n }\n\n console.log(styles.warning('✗ VersionGuard hooks are not installed'));\n process.exit(1);\n } catch (error) {\n console.error(styles.error(`✗ ${(error as Error).message}`));\n process.exit(1);\n }\n });\n\n return program;\n}\n\n/**\n * Parses CLI arguments and executes the matching command.\n *\n * @public\n * @since 0.1.0\n * @remarks\n * This helper delegates argument parsing to the Commander program created by\n * {@link createProgram}. It resolves when the selected command finishes.\n *\n * @param argv - Full argument vector to parse.\n * @see {@link createProgram}\n *\n * @example\n * ```typescript\n * const argv = ['node', 'versionguard', 'check'];\n * await runCli(argv);\n * ```\n */\nexport async function runCli(argv: string[] = process.argv): Promise<void> {\n await createProgram().parseAsync(argv);\n}\n\n/**\n * Determines whether the current module is the invoked CLI entry point.\n *\n * @public\n * @since 0.1.0\n * @remarks\n * This helper compares the resolved script path from `argv` with the current\n * module URL so the CLI runs only during direct execution.\n *\n * @param argv - Full process argument vector.\n * @param metaUrl - Module URL to compare against the invoked entry path.\n * @returns `true` when the current module should launch the CLI.\n *\n * @example\n * ```typescript\n * const shouldRun = shouldRunCli(process.argv, import.meta.url);\n * console.log(shouldRun);\n * ```\n */\nexport function shouldRunCli(\n argv: string[] = process.argv,\n metaUrl: string = import.meta.url,\n): boolean {\n const entryPath = argv[1] ? path.resolve(argv[1]) : null;\n return entryPath === fileURLToPath(metaUrl);\n}\n\n/* v8 ignore start -- exercised only by direct CLI execution */\nif (shouldRunCli()) {\n void runCli();\n}\n/* v8 ignore stop */\n"],"names":["versionguard.initConfig","versionguard.getConfig","versionguard.getPackageVersion","feedback.getVersionFeedback","versionguard.validate","tag.handlePostTag","guard.runGuardChecks","feedback.getSyncFeedback","feedback.getChangelogFeedback","versionguard.doctor","fix.fixAll","fix.fixSyncIssues","fix.suggestNextVersion","project.setPackageVersion","tag.createTag","versionguard.installHooks","versionguard.uninstallHooks","versionguard.areHooksInstalled"],"mappings":";;;;;;;AAQA,MAAM,UAAU,KAAK,QAAQ,cAAc,YAAY,GAAG,CAAC;AAC3D,MAAM,cACJ,KAAK,MAAM,GAAG,aAAa,KAAK,KAAK,SAAS,MAAM,cAAc,GAAG,OAAO,CAAC,EAG7E;AASF,MAAM,SAAS;AAAA,EACb,OAAO,MAAM;AAAA,EACb,SAAS,MAAM;AAAA,EACf,SAAS,MAAM;AAAA,EACf,MAAM,MAAM;AAAA,EACZ,KAAK,MAAM;AAAA,EACX,MAAM,MAAM;AACd;AAmBO,SAAS,gBAAyB;AACvC,QAAM,UAAU,I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AC;AAC3D,cAAQ,KAAK,CAAC;AAAA,IAChB;AAAA,EACF,CAAC;AAEH,eACG,QAAQ,QAAQ,EAChB,YAAY,8BAA8B,EAC1C,OAAO,oBAAoB,qBAAqB,QAAQ,IAAA,CAAK,EAC7D,OAAO,CAAC,YAA6B;AACpC,QAAI;AACF,UAAIC,kBAA+B,QAAQ,GAAG,GAAG;AAC/C,gBAAQ,IAAI,OAAO,QAAQ,oCAAoC,CAAC;AAChE;AAAA,MACF;AAEA,cAAQ,IAAI,OAAO,QAAQ,wCAAwC,CAAC;AACpE,cAAQ,KAAK,CAAC;AAAA,IAChB,SAAS,OAAO;AACd,cAAQ,MAAM,OAAO,MAAM,KAAM,MAAgB,OAAO,EAAE,CAAC;AAC3D,cAAQ,KAAK,CAAC;AAAA,IAChB;AAAA,EACF,CAAC;AAEH,SAAO;AACT;AAoBA,eAAsB,OAAO,OAAiB,QAAQ,MAAqB;AACzE,QAAM,cAAA,EAAgB,WAAW,IAAI;AACvC;AAqBO,SAAS,aACd,OAAiB,QAAQ,MACzB,UAAkB,YAAY,KACrB;AACT,QAAM,YAAY,KAAK,CAAC,IAAI,KAAK,QAAQ,KAAK,CAAC,CAAC,IAAI;AACpD,SAAO,cAAc,cAAc,OAAO;AAC5C;AAGA,IAAI,gBAAgB;AAClB,OAAK,OAAA;AACP;"}
|
|
1
|
+
{"version":3,"file":"cli.js","sources":["../src/init-wizard.ts","../src/cli.ts"],"sourcesContent":["/**\n * Interactive setup wizard and headless init for VersionGuard.\n *\n * @packageDocumentation\n */\n\nimport * as fs from 'node:fs';\nimport * as path from 'node:path';\n\nimport * as p from '@clack/prompts';\nimport * as yaml from 'js-yaml';\n\nimport { isValidCalVerFormat } from './calver';\nimport type { VersionGuardConfig } from './types';\n\n/**\n * Options for headless (non-interactive) initialization.\n *\n * @public\n * @since 0.3.0\n */\nexport interface InitOptions {\n cwd: string;\n type?: 'semver' | 'calver';\n format?: string;\n manifest?: string;\n hooks?: boolean;\n changelog?: boolean;\n yes?: boolean;\n}\n\n/**\n * Runs the interactive setup wizard.\n *\n * @remarks\n * Walks the user through versioning type, CalVer format, manifest source,\n * git hooks, and changelog configuration. Writes `.versionguard.yml` when done.\n *\n * @param cwd - Project directory to initialize.\n * @returns The path to the created config file, or `null` if cancelled.\n *\n * @public\n * @since 0.3.0\n */\nexport async function runWizard(cwd: string): Promise<string | null> {\n p.intro('VersionGuard Setup');\n\n const existingConfig = findExistingConfig(cwd);\n if (existingConfig) {\n p.log.warning(`Config already exists: ${path.relative(cwd, existingConfig)}`);\n const overwrite = await p.confirm({ message: 'Overwrite existing config?' });\n if (p.isCancel(overwrite) || !overwrite) {\n p.outro('Setup cancelled.');\n return null;\n }\n }\n\n // Step 1: Versioning type\n const type = await p.select({\n message: 'Versioning strategy',\n options: [\n { value: 'semver', label: 'SemVer', hint: 'MAJOR.MINOR.PATCH (e.g., 1.2.3)' },\n { value: 'calver', label: 'CalVer', hint: 'Calendar-based (e.g., 2026.3.0)' },\n ],\n });\n if (p.isCancel(type)) {\n p.outro('Setup cancelled.');\n return null;\n }\n\n // Step 2: CalVer format (if calver)\n let format: string | undefined;\n if (type === 'calver') {\n const selected = await selectCalVerFormat();\n if (!selected) {\n p.outro('Setup cancelled.');\n return null;\n }\n format = selected;\n }\n\n // Step 3: Manifest source\n const manifest = await selectManifest(cwd);\n if (manifest === null) {\n p.outro('Setup cancelled.');\n return null;\n }\n\n // Step 4: Git hooks\n const hooks = await p.confirm({\n message: 'Install git hooks? (pre-commit, pre-push, post-tag)',\n initialValue: true,\n });\n if (p.isCancel(hooks)) {\n p.outro('Setup cancelled.');\n return null;\n }\n\n // Step 5: Changelog\n const changelog = await p.confirm({\n message: 'Enable changelog validation?',\n initialValue: true,\n });\n if (p.isCancel(changelog)) {\n p.outro('Setup cancelled.');\n return null;\n }\n\n // Build and write config\n const config = buildConfig({\n type: type,\n format,\n manifest: manifest === 'auto' ? undefined : manifest,\n hooks: hooks,\n changelog: changelog,\n });\n\n const configPath = writeConfig(cwd, config);\n\n p.log.success(`Created ${path.relative(cwd, configPath)}`);\n p.outro('Run `versionguard validate` to verify your setup.');\n\n return configPath;\n}\n\n/**\n * Initializes VersionGuard non-interactively using CLI flags.\n *\n * @remarks\n * When `--yes` is passed, all defaults are used without prompting.\n * Individual flags override specific defaults.\n *\n * @param options - Headless initialization options.\n * @returns The path to the created config file.\n *\n * @public\n * @since 0.3.0\n */\nexport function runHeadless(options: InitOptions): string {\n const existingConfig = findExistingConfig(options.cwd);\n if (existingConfig && !options.yes) {\n throw new Error(`Config already exists: ${existingConfig}. Use --yes to overwrite.`);\n }\n\n const config = buildConfig({\n type: options.type ?? 'semver',\n format: options.format,\n manifest: options.manifest,\n hooks: options.hooks ?? true,\n changelog: options.changelog ?? true,\n });\n\n return writeConfig(options.cwd, config);\n}\n\nasync function selectCalVerFormat(): Promise<string | null> {\n const preset = await p.select({\n message: 'CalVer format',\n options: [\n { value: 'YYYY.M.MICRO', label: 'YYYY.M.MICRO', hint: 'calver.org standard — 2026.3.0' },\n { value: 'YYYY.MM.MICRO', label: 'YYYY.MM.MICRO', hint: 'padded month — 2026.03.0' },\n { value: 'YY.0M.MICRO', label: 'YY.0M.MICRO', hint: 'Twisted/pip style — 26.03.0' },\n { value: 'YYYY.0M.0D', label: 'YYYY.0M.0D', hint: 'date-based — 2026.03.25' },\n {\n value: 'YYYY.0M.0D.MICRO',\n label: 'YYYY.0M.0D.MICRO',\n hint: 'youtube-dl style — 2026.03.25.0',\n },\n { value: 'YY.0M', label: 'YY.0M', hint: 'Ubuntu style — 26.03' },\n { value: 'custom', label: 'Custom...', hint: 'enter your own token format' },\n ],\n });\n if (p.isCancel(preset)) return null;\n\n if (preset === 'custom') {\n const custom = await p.text({\n message: 'Enter CalVer format (dot-separated tokens)',\n placeholder: 'YYYY.MM.MICRO',\n validate(value: string | undefined) {\n if (!value || !isValidCalVerFormat(value)) {\n return 'Invalid format. Use tokens: YYYY|YY|0Y, MM|M|0M, WW|0W, DD|D|0D, MICRO|PATCH';\n }\n },\n });\n if (p.isCancel(custom)) return null;\n return custom;\n }\n\n return preset as string;\n}\n\nasync function selectManifest(cwd: string): Promise<string | null> {\n // Detect what exists\n const detected: { value: string; label: string; hint?: string }[] = [];\n const checks = [\n { file: 'package.json', label: 'package.json', hint: 'Node.js / Bun' },\n { file: 'Cargo.toml', label: 'Cargo.toml', hint: 'Rust' },\n { file: 'pyproject.toml', label: 'pyproject.toml', hint: 'Python' },\n { file: 'pubspec.yaml', label: 'pubspec.yaml', hint: 'Dart / Flutter' },\n { file: 'composer.json', label: 'composer.json', hint: 'PHP' },\n { file: 'pom.xml', label: 'pom.xml', hint: 'Java / Maven' },\n { file: 'VERSION', label: 'VERSION', hint: 'Plain text file' },\n ];\n\n for (const check of checks) {\n if (fs.existsSync(path.join(cwd, check.file))) {\n detected.push({ value: check.file, label: `${check.label} (detected)`, hint: check.hint });\n }\n }\n\n const options = [\n { value: 'auto', label: 'Auto-detect', hint: 'scan for known manifests at runtime' },\n ...detected,\n ...checks\n .filter((c) => !detected.some((d) => d.value === c.file))\n .map((c) => ({ value: c.file, label: c.label, hint: c.hint })),\n { value: 'git-tag', label: 'Git tags', hint: 'Go / Swift — version from tags' },\n ];\n\n const result = await p.select({\n message: 'Version source',\n options,\n initialValue: detected.length === 1 ? detected[0].value : 'auto',\n });\n\n if (p.isCancel(result)) return null;\n return result;\n}\n\ninterface ConfigInput {\n type: 'semver' | 'calver';\n format?: string;\n manifest?: string;\n hooks: boolean;\n changelog: boolean;\n}\n\nfunction buildConfig(input: ConfigInput): Partial<VersionGuardConfig> {\n const config: Record<string, unknown> = {\n versioning: {\n type: input.type,\n ...(input.type === 'calver' && input.format\n ? {\n calver: {\n format: input.format,\n preventFutureDates: true,\n },\n }\n : {}),\n },\n };\n\n if (input.manifest) {\n config.manifest = { source: input.manifest };\n }\n\n config.sync = {\n files: ['README.md', 'CHANGELOG.md'],\n patterns: [\n {\n regex: '(version\\\\s*[=:]\\\\s*[\"\\'])(.+?)([\"\\'])',\n template: '$1{{version}}$3',\n },\n {\n regex: '(##\\\\s*\\\\[)(.+?)(\\\\])',\n template: '$1{{version}}$3',\n },\n ],\n };\n\n config.changelog = {\n enabled: input.changelog,\n file: 'CHANGELOG.md',\n strict: true,\n requireEntry: input.changelog,\n };\n\n config.git = {\n hooks: {\n 'pre-commit': input.hooks,\n 'pre-push': input.hooks,\n 'post-tag': input.hooks,\n },\n enforceHooks: input.hooks,\n };\n\n config.ignore = ['node_modules/**', 'dist/**', '.git/**', '*.lock', '.changeset/**'];\n\n return config;\n}\n\nfunction writeConfig(cwd: string, config: Partial<VersionGuardConfig>): string {\n const configPath = path.join(cwd, '.versionguard.yml');\n const content = yaml.dump(config, {\n indent: 2,\n lineWidth: 120,\n noRefs: true,\n quotingType: '\"',\n forceQuotes: false,\n });\n fs.writeFileSync(configPath, content, 'utf-8');\n return configPath;\n}\n\nfunction findExistingConfig(cwd: string): string | null {\n for (const name of [\n '.versionguard.yml',\n '.versionguard.yaml',\n 'versionguard.yml',\n 'versionguard.yaml',\n ]) {\n const full = path.join(cwd, name);\n if (fs.existsSync(full)) return full;\n }\n return null;\n}\n","#!/usr/bin/env node\nimport * as fs from 'node:fs';\nimport * as path from 'node:path';\nimport { fileURLToPath } from 'node:url';\n\nimport chalk from 'chalk';\nimport { Command } from 'commander';\n\nconst CLI_DIR = path.dirname(fileURLToPath(import.meta.url));\nconst CLI_VERSION: string = (\n JSON.parse(fs.readFileSync(path.join(CLI_DIR, '..', 'package.json'), 'utf-8')) as {\n version: string;\n }\n).version;\n\nimport * as feedback from './feedback';\nimport * as fix from './fix';\nimport * as guard from './guard';\nimport * as versionguard from './index';\nimport { runHeadless, runWizard } from './init-wizard';\nimport * as project from './project';\nimport * as tag from './tag';\n\nconst styles = {\n error: chalk.red,\n warning: chalk.yellow,\n success: chalk.green,\n info: chalk.blue,\n dim: chalk.gray,\n bold: chalk.bold,\n};\n\n/**\n * Creates the VersionGuard CLI program definition.\n *\n * @public\n * @since 0.1.0\n * @remarks\n * This function wires all commands, options, and handlers onto a fresh Commander\n * program instance without parsing arguments yet.\n *\n * @returns A configured Commander program for the VersionGuard CLI.\n *\n * @example\n * ```typescript\n * const program = createProgram();\n * console.log(program.name());\n * ```\n */\nexport function createProgram(): Command {\n const program = new Command();\n\n program\n .name('versionguard')\n .description('Strict versioning enforcement for SemVer and CalVer')\n .version(CLI_VERSION);\n\n program\n .command('init')\n .description('Initialize VersionGuard configuration (interactive wizard or headless)')\n .option('-c, --cwd <path>', 'Working directory', process.cwd())\n .option('-t, --type <type>', 'Versioning type: semver or calver')\n .option('-f, --format <format>', 'CalVer format tokens (e.g., YYYY.M.MICRO)')\n .option('--manifest <source>', 'Manifest source (e.g., Cargo.toml, pyproject.toml, auto)')\n .option('--hooks', 'Install git hooks (default: true)')\n .option('--no-hooks', 'Skip git hooks')\n .option('--changelog', 'Enable changelog validation (default: true)')\n .option('--no-changelog', 'Disable changelog validation')\n .option('-y, --yes', 'Accept all defaults, no prompts')\n .action(\n async (options: {\n cwd: string;\n type?: string;\n format?: string;\n manifest?: string;\n hooks?: boolean;\n changelog?: boolean;\n yes?: boolean;\n }) => {\n try {\n const isHeadless = options.yes || options.type || options.format || options.manifest;\n\n let configPath: string | null;\n\n if (isHeadless) {\n // Headless mode: use flags, no prompts\n configPath = runHeadless({\n cwd: options.cwd,\n type: options.type as 'semver' | 'calver' | undefined,\n format: options.format,\n manifest: options.manifest,\n hooks: options.hooks,\n changelog: options.changelog,\n yes: options.yes,\n });\n console.log(styles.success(`✓ Created ${path.relative(options.cwd, configPath)}`));\n } else {\n // Interactive wizard\n configPath = await runWizard(options.cwd);\n if (!configPath) {\n process.exit(0);\n return;\n }\n }\n\n // Auto-install hooks if enabled\n try {\n const config = versionguard.getConfig(options.cwd);\n if (config.git.enforceHooks) {\n versionguard.installHooks(config.git, options.cwd);\n console.log(styles.success('✓ Git hooks installed'));\n }\n } catch {\n console.log(styles.info('ℹ Skipped hooks install (not a git repository)'));\n }\n } catch (error) {\n console.error(styles.error(`✗ ${(error as Error).message}`));\n process.exit(1);\n }\n },\n );\n\n program\n .command('check')\n .description('Check the current version with actionable feedback')\n .option('-c, --cwd <path>', 'Working directory', process.cwd())\n .option('--prev <version>', 'Previous version for comparison')\n .option('--json', 'Print machine-readable JSON output')\n .action((options: { cwd: string; prev?: string; json?: boolean }) => {\n try {\n const config = versionguard.getConfig(options.cwd);\n const version = versionguard.getPackageVersion(options.cwd, config.manifest);\n const result = feedback.getVersionFeedback(version, config, options.prev);\n\n if (options.json) {\n console.log(\n JSON.stringify(\n {\n version,\n versioningType: config.versioning.type,\n valid: result.valid,\n errors: result.errors,\n suggestions: result.suggestions,\n },\n null,\n 2,\n ),\n );\n if (!result.valid) {\n process.exit(1);\n }\n return;\n }\n\n console.log(styles.bold(`Current version: ${version}`));\n console.log(styles.dim(`Versioning type: ${config.versioning.type}`));\n console.log('');\n\n if (result.valid) {\n console.log(styles.success('✓ Version is valid'));\n return;\n }\n\n console.log(styles.error('✗ Version has issues:'));\n console.log('');\n for (const error of result.errors) {\n console.log(styles.error(` ✗ ${error.message}`));\n }\n if (result.suggestions.length > 0) {\n console.log('');\n console.log(styles.info('How to fix:'));\n for (const suggestion of result.suggestions) {\n console.log(` → ${suggestion.message}`);\n if (suggestion.fix) {\n console.log(styles.dim(` Run: ${suggestion.fix}`));\n }\n }\n }\n process.exit(1);\n } catch (error) {\n console.error(styles.error(`✗ ${(error as Error).message}`));\n process.exit(1);\n }\n });\n\n program\n .command('validate')\n .description('Run full validation with smart feedback')\n .option('-c, --cwd <path>', 'Working directory', process.cwd())\n .option('--hook <name>', 'Running as git hook')\n .option('--json', 'Print machine-readable JSON output')\n .option('--strict', 'Run guard checks and fail on any policy gap or bypass')\n .action((options: { cwd: string; hook?: string; json?: boolean; strict?: boolean }) => {\n try {\n const config = versionguard.getConfig(options.cwd);\n const version = versionguard.getPackageVersion(options.cwd, config.manifest);\n const result = versionguard.validate(config, options.cwd);\n\n let postTagResult: { success: boolean; message: string; actions: string[] } | undefined;\n let guardReport: guard.GuardReport | undefined;\n\n if (options.hook === 'post-tag') {\n postTagResult = tag.handlePostTag(config, options.cwd);\n }\n\n if (options.strict) {\n guardReport = guard.runGuardChecks(config, options.cwd);\n }\n\n if (options.json) {\n console.log(\n JSON.stringify(\n {\n ...result,\n hook: options.hook ?? null,\n postTag: postTagResult ?? null,\n guard: guardReport ?? null,\n },\n null,\n 2,\n ),\n );\n\n if (\n !result.valid ||\n (postTagResult && !postTagResult.success) ||\n (guardReport && !guardReport.safe)\n ) {\n process.exit(1);\n }\n\n return;\n }\n\n console.log(styles.bold(`Validating version ${version}...`));\n console.log('');\n\n if (!result.syncValid) {\n console.log(styles.error('Sync Issues:'));\n for (const error of result.errors.filter((item) => item.includes('mismatch'))) {\n const parts = error.match(\n /Version mismatch in (.+):(\\d+) - found \"(.+?)\" but expected \"(.+?)\"/,\n );\n if (!parts) {\n continue;\n }\n const suggestions = feedback.getSyncFeedback(parts[1], parts[3], parts[4]);\n console.log(styles.error(` ✗ ${parts[1]} has wrong version`));\n console.log(styles.dim(` Found: \"${parts[3]}\" Expected: \"${parts[4]}\"`));\n if (suggestions[0]?.fix) {\n console.log(styles.info(` Fix: ${suggestions[0].fix}`));\n }\n }\n console.log('');\n }\n\n if (config.changelog.enabled && !result.changelogValid) {\n console.log(styles.error('Changelog Issues:'));\n for (const error of result.errors.filter((item) =>\n item.toLowerCase().includes('changelog'),\n )) {\n console.log(styles.error(` ✗ ${error}`));\n }\n const suggestions = feedback.getChangelogFeedback(false, version);\n if (suggestions[0]?.fix) {\n console.log(styles.info(`Fix: ${suggestions[0].fix}`));\n }\n console.log('');\n }\n\n if (postTagResult) {\n if (!postTagResult.success) {\n console.log(styles.error(`✗ ${postTagResult.message}`));\n process.exit(1);\n }\n }\n\n if (guardReport && guardReport.warnings.length > 0) {\n console.log(styles.bold('Guard Checks:'));\n for (const warning of guardReport.warnings) {\n const icon = warning.severity === 'error' ? styles.error('✗') : styles.warning('⚠');\n console.log(` ${icon} [${warning.code}] ${warning.message}`);\n if (warning.fix) {\n console.log(styles.dim(` Fix: ${warning.fix}`));\n }\n }\n console.log('');\n }\n\n if (!result.valid || (guardReport && !guardReport.safe)) {\n console.log(styles.error('✗ Validation failed'));\n process.exit(1);\n }\n\n console.log(styles.success('✓ All validations passed'));\n } catch (error) {\n console.error(styles.error(`✗ ${(error as Error).message}`));\n process.exit(1);\n }\n });\n\n program\n .command('doctor')\n .description('Report repository readiness in one pass')\n .option('-c, --cwd <path>', 'Working directory', process.cwd())\n .option('--json', 'Print machine-readable JSON output')\n .option('--strict', 'Include guard checks for bypass detection')\n .action((options: { cwd: string; json?: boolean; strict?: boolean }) => {\n try {\n const config = versionguard.getConfig(options.cwd);\n const report = versionguard.doctor(config, options.cwd);\n const guardReport = options.strict ? guard.runGuardChecks(config, options.cwd) : undefined;\n\n if (options.json) {\n console.log(JSON.stringify({ ...report, guard: guardReport ?? null }, null, 2));\n if (!report.ready || (guardReport && !guardReport.safe)) {\n process.exit(1);\n }\n return;\n }\n\n console.log(styles.bold('VersionGuard Doctor'));\n console.log(` Version: ${report.version || '(missing)'}`);\n console.log(` Version valid: ${report.versionValid ? 'yes' : 'no'}`);\n console.log(` Files in sync: ${report.syncValid ? 'yes' : 'no'}`);\n console.log(` Changelog ready: ${report.changelogValid ? 'yes' : 'no'}`);\n console.log(` Git repository: ${report.gitRepository ? 'yes' : 'no'}`);\n console.log(\n ` Hooks installed: ${report.gitRepository ? (report.hooksInstalled ? 'yes' : 'no') : 'n/a'}`,\n );\n console.log(\n ` Worktree clean: ${report.gitRepository ? (report.worktreeClean ? 'yes' : 'no') : 'n/a'}`,\n );\n\n if (guardReport) {\n console.log(` Guard safe: ${guardReport.safe ? 'yes' : 'no'}`);\n }\n\n if (!report.ready || (guardReport && !guardReport.safe)) {\n console.log('');\n console.log(styles.error('Issues:'));\n for (const error of report.errors) {\n console.log(styles.error(` ✗ ${error}`));\n }\n if (guardReport) {\n for (const warning of guardReport.warnings) {\n const icon = warning.severity === 'error' ? '✗' : '⚠';\n console.log(styles.error(` ${icon} [${warning.code}] ${warning.message}`));\n if (warning.fix) {\n console.log(styles.dim(` Fix: ${warning.fix}`));\n }\n }\n }\n process.exit(1);\n }\n\n console.log('');\n console.log(styles.success('✓ Repository is ready'));\n } catch (error) {\n console.error(styles.error(`✗ ${(error as Error).message}`));\n process.exit(1);\n }\n });\n\n program\n .command('fix')\n .description('Auto-fix detected issues')\n .option('-c, --cwd <path>', 'Working directory', process.cwd())\n .action((options: { cwd: string }) => {\n try {\n const config = versionguard.getConfig(options.cwd);\n const version = versionguard.getPackageVersion(options.cwd, config.manifest);\n const results = fix.fixAll(config, version, options.cwd);\n\n console.log(styles.bold(`Fixing issues for version ${version}...`));\n console.log('');\n\n for (const result of results) {\n const printer = result.fixed ? styles.success : styles.dim;\n console.log(printer(`${result.fixed ? '✓' : '•'} ${result.message}`));\n }\n } catch (error) {\n console.error(styles.error(`✗ ${(error as Error).message}`));\n process.exit(1);\n }\n });\n\n program\n .command('sync')\n .description('Sync version to all configured files')\n .option('-c, --cwd <path>', 'Working directory', process.cwd())\n .action((options: { cwd: string }) => {\n try {\n const config = versionguard.getConfig(options.cwd);\n const version = versionguard.getPackageVersion(options.cwd, config.manifest);\n const results = fix.fixSyncIssues(config, options.cwd);\n\n console.log(styles.bold(`Syncing version ${version}...`));\n for (const result of results) {\n const printer = result.fixed ? styles.success : styles.dim;\n console.log(printer(`${result.fixed ? '✓' : '•'} ${result.message}`));\n }\n } catch (error) {\n console.error(styles.error(`✗ ${(error as Error).message}`));\n process.exit(1);\n }\n });\n\n program\n .command('bump')\n .description('Suggest and optionally apply the next version')\n .option('-c, --cwd <path>', 'Working directory', process.cwd())\n .option('-t, --type <type>', 'Bump type (major, minor, patch, auto)')\n .option('--apply', 'Apply the first suggested version')\n .action(\n (options: { cwd: string; type?: 'major' | 'minor' | 'patch' | 'auto'; apply?: boolean }) => {\n try {\n const config = versionguard.getConfig(options.cwd);\n const currentVersion = versionguard.getPackageVersion(options.cwd, config.manifest);\n const suggestions = fix.suggestNextVersion(currentVersion, config, options.type);\n\n console.log(styles.bold(`Current version: ${currentVersion}`));\n console.log('');\n for (const [index, suggestion] of suggestions.entries()) {\n console.log(` ${index + 1}. ${styles.bold(suggestion.version)}`);\n console.log(` ${styles.dim(suggestion.reason)}`);\n }\n\n if (options.apply) {\n const nextVersion = suggestions[0]?.version;\n if (!nextVersion) {\n throw new Error('No version suggestion available');\n }\n project.setPackageVersion(nextVersion, options.cwd, config.manifest);\n fix.fixAll(config, nextVersion, options.cwd);\n console.log(styles.success(`✓ Updated to ${nextVersion}`));\n }\n } catch (error) {\n console.error(styles.error(`✗ ${(error as Error).message}`));\n process.exit(1);\n }\n },\n );\n\n program\n .command('tag')\n .description('Create a git tag with automation')\n .argument('[version]', 'Version to tag (defaults to manifest version)')\n .option('-c, --cwd <path>', 'Working directory', process.cwd())\n .option('-m, --message <msg>', 'Tag message')\n .option('--no-fix', 'Skip auto-fixing files before tagging')\n .action(\n (version: string | undefined, options: { cwd: string; message?: string; fix?: boolean }) => {\n try {\n const config = versionguard.getConfig(options.cwd);\n const tagVersion =\n version || versionguard.getPackageVersion(options.cwd, config.manifest);\n const result = tag.createTag(\n tagVersion,\n options.message,\n options.fix !== false,\n config,\n options.cwd,\n );\n\n if (!result.success) {\n console.log(styles.error(`✗ ${result.message}`));\n process.exit(1);\n }\n\n console.log(styles.success(`✓ ${result.message}`));\n for (const action of result.actions) {\n console.log(` • ${action}`);\n }\n } catch (error) {\n console.error(styles.error(`✗ ${(error as Error).message}`));\n process.exit(1);\n }\n },\n );\n\n const hooksCommand = program.command('hooks').description('Manage git hooks');\n\n hooksCommand\n .command('install')\n .description('Install git hooks')\n .option('-c, --cwd <path>', 'Working directory', process.cwd())\n .action((options: { cwd: string }) => {\n try {\n const config = versionguard.getConfig(options.cwd);\n versionguard.installHooks(config.git, options.cwd);\n console.log(styles.success('✓ Git hooks installed'));\n } catch (error) {\n console.error(styles.error(`✗ ${(error as Error).message}`));\n process.exit(1);\n }\n });\n\n hooksCommand\n .command('uninstall')\n .description('Uninstall git hooks')\n .option('-c, --cwd <path>', 'Working directory', process.cwd())\n .action((options: { cwd: string }) => {\n try {\n versionguard.uninstallHooks(options.cwd);\n console.log(styles.success('✓ Git hooks uninstalled'));\n } catch (error) {\n console.error(styles.error(`✗ ${(error as Error).message}`));\n process.exit(1);\n }\n });\n\n hooksCommand\n .command('status')\n .description('Check if hooks are installed')\n .option('-c, --cwd <path>', 'Working directory', process.cwd())\n .action((options: { cwd: string }) => {\n try {\n if (versionguard.areHooksInstalled(options.cwd)) {\n console.log(styles.success('✓ VersionGuard hooks are installed'));\n return;\n }\n\n console.log(styles.warning('✗ VersionGuard hooks are not installed'));\n process.exit(1);\n } catch (error) {\n console.error(styles.error(`✗ ${(error as Error).message}`));\n process.exit(1);\n }\n });\n\n return program;\n}\n\n/**\n * Parses CLI arguments and executes the matching command.\n *\n * @public\n * @since 0.1.0\n * @remarks\n * This helper delegates argument parsing to the Commander program created by\n * {@link createProgram}. It resolves when the selected command finishes.\n *\n * @param argv - Full argument vector to parse.\n * @see {@link createProgram}\n *\n * @example\n * ```typescript\n * const argv = ['node', 'versionguard', 'check'];\n * await runCli(argv);\n * ```\n */\nexport async function runCli(argv: string[] = process.argv): Promise<void> {\n await createProgram().parseAsync(argv);\n}\n\n/**\n * Determines whether the current module is the invoked CLI entry point.\n *\n * @public\n * @since 0.1.0\n * @remarks\n * This helper compares the resolved script path from `argv` with the current\n * module URL so the CLI runs only during direct execution.\n *\n * @param argv - Full process argument vector.\n * @param metaUrl - Module URL to compare against the invoked entry path.\n * @returns `true` when the current module should launch the CLI.\n *\n * @example\n * ```typescript\n * const shouldRun = shouldRunCli(process.argv, import.meta.url);\n * console.log(shouldRun);\n * ```\n */\nexport function shouldRunCli(\n argv: string[] = process.argv,\n metaUrl: string = import.meta.url,\n): boolean {\n const entryPath = argv[1] ? path.resolve(argv[1]) : null;\n return entryPath === fileURLToPath(metaUrl);\n}\n\n/* v8 ignore start -- exercised only by direct CLI execution */\nif (shouldRunCli()) {\n void runCli();\n}\n/* v8 ignore stop */\n"],"names":["versionguard.getConfig","versionguard.installHooks","versionguard.getPackageVersion","feedback.getVersionFeedback","versionguard.validate","tag.handlePostTag","guard.runGuardChecks","feedback.getSyncFeedback","feedback.getChangelogFeedback","versionguard.doctor","fix.fixAll","fix.fixSyncIssues","fix.suggestNextVersion","project.setPackageVersion","tag.createTag","versionguard.uninstallHooks","versionguard.areHooksInstalled"],"mappings":";;;;;;;;;AA4CA,eAAsB,UAAU,KAAqC;AACnE,IAAE,MAAM,oBAAoB;AAE5B,QAAM,iBAAiB,mBAAmB,GAAG;AAC7C,MAAI,gBAAgB;AAClB,MAAE,IAAI,QAAQ,0BAA0B,KAAK,SAAS,KAAK,cAAc,CAAC,EAAE;AAC5E,UAAM,YAAY,MAAM,EAAE,QAAQ,EAAE,SAAS,8BAA8B;AAC3E,QAAI,EAAE,SAAS,SAAS,KAAK,CAAC,WAAW;AACvC,QAAE,MAAM,kBAAkB;AAC1B,aAAO;AAAA,IACT;AAAA,EACF;AAGA,QAAM,OAAO,MAAM,EAAE,OAAO;AAAA,IAC1B,SAAS;AAAA,IACT,SAAS;AAAA,MACP,EAAE,OAAO,UAAU,OAAO,UAAU,MAAM,kCAAA;AAAA,MAC1C,EAAE,OAAO,UAAU,OAAO,UAAU,MAAM,kCAAA;AAAA,IAAkC;AAAA,EAC9E,CACD;AACD,MAAI,EAAE,SAAS,IAAI,GAAG;AACpB,MAAE,MAAM,kBAAkB;AAC1B,WAAO;AAAA,EACT;AAGA,MAAI;AACJ,MAAI,SAAS,UAAU;AACrB,UAAM,WAAW,MAAM,mBAAA;AACvB,QAAI,CAAC,UAAU;AACb,QAAE,MAAM,kBAAkB;AAC1B,aAAO;AAAA,IACT;AACA,aAAS;AAAA,EACX;AAGA,QAAM,WAAW,MAAM,eAAe,GAAG;AACzC,MAAI,aAAa,MAAM;AACr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;AACd,cAAQ,MAAM,OAAO,MAAM,KAAM,MAAgB,OAAO,EAAE,CAAC;AAC3D,cAAQ,KAAK,CAAC;AAAA,IAChB;AAAA,EACF,CAAC;AAEH,SAAO;AACT;AAoBA,eAAsB,OAAO,OAAiB,QAAQ,MAAqB;AACzE,QAAM,cAAA,EAAgB,WAAW,IAAI;AACvC;AAqBO,SAAS,aACd,OAAiB,QAAQ,MACzB,UAAkB,YAAY,KACrB;AACT,QAAM,YAAY,KAAK,CAAC,IAAI,KAAK,QAAQ,KAAK,CAAC,CAAC,IAAI;AACpD,SAAO,cAAc,cAAc,OAAO;AAC5C;AAGA,IAAI,gBAAgB;AAClB,OAAK,OAAA;AACP;"}
|
package/dist/config.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAyDlD;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,gBAAgB,IAAI,kBAAkB,CAErD;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,UAAU,CAAC,GAAG,GAAE,MAAsB,GAAG,MAAM,GAAG,IAAI,CASrE;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,UAAU,CAAC,UAAU,EAAE,MAAM,GAAG,kBAAkB,CAajE;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,SAAS,CAAC,GAAG,GAAE,MAAsB,GAAG,kBAAkB,CAGzE;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,UAAU,CAAC,GAAG,GAAE,MAAsB,GAAG,MAAM,CAe9D"}
|
package/dist/feedback/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/feedback/index.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/feedback/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAIL,KAAK,eAAe,EACpB,KAAK,kBAAkB,EACxB,MAAM,UAAU,CAAC;AAElB;;;;;GAKG;AAEH;;;;;;;GAOG;AACH,MAAM,WAAW,UAAU;IACzB;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;IAEhB;;;;OAIG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,WAAW,EAAE,OAAO,CAAC;CACtB;AAED;;;;;GAKG;AACH,MAAM,WAAW,cAAc;IAC7B;;OAEG;IACH,KAAK,EAAE,OAAO,CAAC;IAEf;;OAEG;IACH,MAAM,EAAE,eAAe,EAAE,CAAC;IAE1B;;OAEG;IACH,WAAW,EAAE,UAAU,EAAE,CAAC;IAE1B;;OAEG;IACH,UAAU,EAAE,OAAO,CAAC;CACrB;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,kBAAkB,EAC1B,eAAe,CAAC,EAAE,MAAM,GACvB,cAAc,CAMhB;AAuPD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,eAAe,CAC7B,IAAI,EAAE,MAAM,EACZ,YAAY,EAAE,MAAM,EACpB,eAAe,EAAE,MAAM,GACtB,UAAU,EAAE,CAyBd;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,oBAAoB,CAClC,QAAQ,EAAE,OAAO,EACjB,OAAO,EAAE,MAAM,EACf,sBAAsB,CAAC,EAAE,MAAM,GAC9B,UAAU,EAAE,CAyBd;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,cAAc,CAC5B,UAAU,EAAE,MAAM,EAClB,cAAc,EAAE,MAAM,EACtB,gBAAgB,EAAE,OAAO,GACxB,UAAU,EAAE,CAoBd"}
|
package/dist/fix/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type ManifestConfig, type VersionGuardConfig } from '../types';
|
|
2
2
|
/**
|
|
3
3
|
* Auto-fix helpers for package versions, synced files, and changelog entries.
|
|
4
4
|
*
|
|
@@ -40,15 +40,20 @@ export interface FixResult {
|
|
|
40
40
|
*
|
|
41
41
|
* @param targetVersion - Version that should be written to `package.json`.
|
|
42
42
|
* @param cwd - Repository directory containing `package.json`.
|
|
43
|
+
* @param manifest - Optional manifest configuration for language-agnostic support.
|
|
43
44
|
* @returns The result of the package version fix attempt.
|
|
44
45
|
*
|
|
45
46
|
* @example
|
|
46
47
|
* ```typescript
|
|
48
|
+
* // Fix using legacy package.json fallback
|
|
47
49
|
* const result = fixPackageVersion('1.2.3', process.cwd());
|
|
48
50
|
* console.log(result.fixed);
|
|
51
|
+
*
|
|
52
|
+
* // Fix using a configured manifest source
|
|
53
|
+
* const result2 = fixPackageVersion('1.2.3', process.cwd(), { source: 'Cargo.toml' });
|
|
49
54
|
* ```
|
|
50
55
|
*/
|
|
51
|
-
export declare function fixPackageVersion(targetVersion: string, cwd?: string): FixResult;
|
|
56
|
+
export declare function fixPackageVersion(targetVersion: string, cwd?: string, manifest?: ManifestConfig): FixResult;
|
|
52
57
|
/**
|
|
53
58
|
* Synchronizes configured files to the package version.
|
|
54
59
|
*
|
package/dist/fix/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/fix/index.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/fix/index.ts"],"names":[],"mappings":"AAQA,OAAO,EAAmB,KAAK,cAAc,EAAE,KA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