@codluv/versionguard 0.5.0 → 0.7.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/cli.js CHANGED
@@ -4,1020 +4,11 @@ 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 isValidCalVerFormat, c as createCkmEngine, g as getConfig, a as installHooks, b as getPackageVersion, d as getVersionFeedback, v as validate, h as handlePostTag, r as runGuardChecks, e as getSyncFeedback, f as getChangelogFeedback, j as doctor, k as fixAll, l as isChangesetMangled, m as fixChangesetMangling, n as fixSyncIssues, s as suggestNextVersion, o as setPackageVersion, p as createTag, u as uninstallHooks, q as areHooksInstalled, t as findProjectRoot, w as formatNotProjectError } from "./chunks/index-CwOyEn5L.js";
7
+ import { i as isValidCalVerFormat, c as createCkmEngine, g as getConfig, a as installHooks, b as getPackageVersion, d as getVersionFeedback, v as validate, h as handlePostTag, r as runGuardChecks, e as getSyncFeedback, f as getChangelogFeedback, j as doctor, k as fixAll, l as isChangesetMangled, m as fixChangesetMangling, n as fixSyncIssues, s as suggestNextVersion, o as setPackageVersion, p as createTag, u as uninstallHooks, q as areHooksInstalled, t as findProjectRoot, w as formatNotProjectError } from "./chunks/index-DWiw8Nps.js";
8
8
  import * as p from "@clack/prompts";
9
9
  import * as yaml from "js-yaml";
10
- const ckmRaw = `{
11
- "$schema": "https://forge-ts.dev/schemas/ckm/v1.json",
12
- "version": "1.0.0",
13
- "project": "@codluv/versionguard",
14
- "generated": "2026-03-26T15:45:30.788Z",
15
- "concepts": [
16
- {
17
- "id": "concept-ManifestConfig",
18
- "name": "ManifestConfig",
19
- "what": "Configures the version source manifest.",
20
- "properties": [
21
- {
22
- "name": "source",
23
- "type": "ManifestSourceType",
24
- "description": "Manifest file to read the version from. Use \`'auto'\` for file-existence detection or a specific filename."
25
- },
26
- {
27
- "name": "path",
28
- "type": "string | undefined",
29
- "description": "Dotted key path to the version field within the manifest. For example \`'version'\` for package.json, \`'package.version'\` for Cargo.toml, or \`'project.version'\` for pyproject.toml."
30
- },
31
- {
32
- "name": "regex",
33
- "type": "string | undefined",
34
- "description": "Regex pattern to extract the version from source-code manifests. Capture group 1 must contain the version string."
35
- }
36
- ]
37
- },
38
- {
39
- "id": "concept-CalVerConfig",
40
- "name": "CalVerConfig",
41
- "what": "Configures CalVer validation rules.",
42
- "properties": [
43
- {
44
- "name": "format",
45
- "type": "CalVerFormat",
46
- "description": "Calendar format used when parsing and validating versions."
47
- },
48
- {
49
- "name": "preventFutureDates",
50
- "type": "boolean",
51
- "description": "Rejects versions that point to a future date."
52
- },
53
- {
54
- "name": "strictMutualExclusion",
55
- "type": "boolean | undefined",
56
- "description": "Enforces that week tokens (WW/0W) cannot be mixed with month/day tokens."
57
- }
58
- ]
59
- },
60
- {
61
- "id": "concept-SyncConfig",
62
- "name": "SyncConfig",
63
- "what": "Configures files and patterns that should stay in sync with the canonical version.",
64
- "properties": [
65
- {
66
- "name": "files",
67
- "type": "string[]",
68
- "description": "File globs or paths that should be scanned for version updates."
69
- },
70
- {
71
- "name": "patterns",
72
- "type": "SyncPattern[]",
73
- "description": "Replacement patterns applied to matching files."
74
- }
75
- ]
76
- },
77
- {
78
- "id": "concept-ChangelogConfig",
79
- "name": "ChangelogConfig",
80
- "what": "Controls changelog validation behavior.",
81
- "properties": [
82
- {
83
- "name": "enabled",
84
- "type": "boolean",
85
- "description": "Enables changelog validation."
86
- },
87
- {
88
- "name": "file",
89
- "type": "string",
90
- "description": "Path to the changelog file to inspect."
91
- },
92
- {
93
- "name": "strict",
94
- "type": "boolean",
95
- "description": "Treats changelog problems as hard failures."
96
- },
97
- {
98
- "name": "requireEntry",
99
- "type": "boolean",
100
- "description": "Requires an entry for the current version."
101
- }
102
- ]
103
- },
104
- {
105
- "id": "concept-GitHooksConfig",
106
- "name": "GitHooksConfig",
107
- "what": "Toggles each supported git hook integration.",
108
- "properties": [
109
- {
110
- "name": "'pre-commit'",
111
- "type": "boolean",
112
- "description": "Enables validation during the \`pre-commit\` hook."
113
- },
114
- {
115
- "name": "'pre-push'",
116
- "type": "boolean",
117
- "description": "Enables validation during the \`pre-push\` hook."
118
- },
119
- {
120
- "name": "'post-tag'",
121
- "type": "boolean",
122
- "description": "Enables follow-up tasks after a tag is created."
123
- }
124
- ]
125
- },
126
- {
127
- "id": "concept-GitConfig",
128
- "name": "GitConfig",
129
- "what": "Configures git-related enforcement.",
130
- "properties": [
131
- {
132
- "name": "hooks",
133
- "type": "GitHooksConfig",
134
- "description": "Hook toggles used by the CLI and validation workflow."
135
- },
136
- {
137
- "name": "enforceHooks",
138
- "type": "boolean",
139
- "description": "Fails validation when required hooks are missing."
140
- }
141
- ]
142
- },
143
- {
144
- "id": "concept-VersioningConfig",
145
- "name": "VersioningConfig",
146
- "what": "Configures the active versioning mode.",
147
- "properties": [
148
- {
149
- "name": "type",
150
- "type": "VersioningType",
151
- "description": "Versioning strategy used for the project."
152
- },
153
- {
154
- "name": "schemeRules",
155
- "type": "SchemeRules | undefined",
156
- "description": "Scheme-level validation rules applied regardless of versioning type."
157
- },
158
- {
159
- "name": "calver",
160
- "type": "CalVerConfig | undefined",
161
- "description": "CalVer-specific settings when \`type\` is \`'calver'\`."
162
- }
163
- ]
164
- },
165
- {
166
- "id": "concept-VersionGuardConfig",
167
- "name": "VersionGuardConfig",
168
- "what": "Top-level configuration consumed by versionguard.",
169
- "properties": [
170
- {
171
- "name": "versioning",
172
- "type": "VersioningConfig",
173
- "description": "Active versioning settings."
174
- },
175
- {
176
- "name": "manifest",
177
- "type": "ManifestConfig",
178
- "description": "Version source manifest settings."
179
- },
180
- {
181
- "name": "sync",
182
- "type": "SyncConfig",
183
- "description": "Synchronization settings for mirrored version strings."
184
- },
185
- {
186
- "name": "changelog",
187
- "type": "ChangelogConfig",
188
- "description": "Changelog validation settings."
189
- },
190
- {
191
- "name": "git",
192
- "type": "GitConfig",
193
- "description": "Git enforcement settings."
194
- },
195
- {
196
- "name": "ignore",
197
- "type": "string[]",
198
- "description": "Files or patterns excluded from validation."
199
- }
200
- ]
201
- },
202
- {
203
- "id": "concept-ValidationResult",
204
- "name": "ValidationResult",
205
- "what": "Result returned by version parsing and validation helpers.",
206
- "properties": [
207
- {
208
- "name": "valid",
209
- "type": "boolean",
210
- "description": "Indicates whether validation completed without errors."
211
- },
212
- {
213
- "name": "errors",
214
- "type": "ValidationError[]",
215
- "description": "Collected validation issues."
216
- },
217
- {
218
- "name": "version",
219
- "type": "ParsedVersion | undefined",
220
- "description": "Parsed version details when validation succeeds."
221
- }
222
- ]
223
- },
224
- {
225
- "id": "concept-SyncResult",
226
- "name": "SyncResult",
227
- "what": "Reports the result of synchronizing a single file.",
228
- "properties": [
229
- {
230
- "name": "file",
231
- "type": "string",
232
- "description": "File that was inspected or updated."
233
- },
234
- {
235
- "name": "updated",
236
- "type": "boolean",
237
- "description": "Indicates whether the file content changed."
238
- },
239
- {
240
- "name": "changes",
241
- "type": "SyncChange[]",
242
- "description": "Detailed replacements applied within the file."
243
- }
244
- ]
245
- },
246
- {
247
- "id": "concept-FullValidationResult",
248
- "name": "FullValidationResult",
249
- "what": "Combined result from a full project validation run.",
250
- "properties": [
251
- {
252
- "name": "valid",
253
- "type": "boolean",
254
- "description": "Indicates whether all checks passed."
255
- },
256
- {
257
- "name": "version",
258
- "type": "string",
259
- "description": "Canonical version string used for validation."
260
- },
261
- {
262
- "name": "versionValid",
263
- "type": "boolean",
264
- "description": "Indicates whether the root version string is valid."
265
- },
266
- {
267
- "name": "syncValid",
268
- "type": "boolean",
269
- "description": "Indicates whether synchronized files are in sync."
270
- },
271
- {
272
- "name": "changelogValid",
273
- "type": "boolean",
274
- "description": "Indicates whether changelog checks passed."
275
- },
276
- {
277
- "name": "errors",
278
- "type": "string[]",
279
- "description": "Human-readable validation failures collected during the run."
280
- }
281
- ]
282
- },
283
- {
284
- "id": "concept-ChangelogValidationResult",
285
- "name": "ChangelogValidationResult",
286
- "what": "Describes the outcome of validating a changelog file.",
287
- "properties": [
288
- {
289
- "name": "valid",
290
- "type": "boolean",
291
- "description": "Indicates whether the changelog satisfies all requested checks."
292
- },
293
- {
294
- "name": "errors",
295
- "type": "string[]",
296
- "description": "Human-readable validation errors."
297
- },
298
- {
299
- "name": "hasEntryForVersion",
300
- "type": "boolean",
301
- "description": "Indicates whether the changelog contains an entry for the requested version."
302
- }
303
- ]
304
- },
305
- {
306
- "id": "concept-FeedbackResult",
307
- "name": "FeedbackResult",
308
- "what": "Aggregates validation errors with suggested next steps.",
309
- "properties": [
310
- {
311
- "name": "valid",
312
- "type": "boolean",
313
- "description": "Indicates whether the inspected version state is valid."
314
- },
315
- {
316
- "name": "errors",
317
- "type": "ValidationError[]",
318
- "description": "Validation errors collected during the check."
319
- },
320
- {
321
- "name": "suggestions",
322
- "type": "Suggestion[]",
323
- "description": "Suggested next steps for resolving the reported issues."
324
- },
325
- {
326
- "name": "canAutoFix",
327
- "type": "boolean",
328
- "description": "Indicates whether at least one suggestion can be auto-applied."
329
- }
330
- ]
331
- },
332
- {
333
- "id": "concept-FixResult",
334
- "name": "FixResult",
335
- "what": "Fix entry point exports for auto-remediation helpers.",
336
- "properties": [
337
- {
338
- "name": "fixed",
339
- "type": "boolean",
340
- "description": "Indicates whether the operation changed repository state."
341
- },
342
- {
343
- "name": "message",
344
- "type": "string",
345
- "description": "Human-readable description of the fix attempt."
346
- },
347
- {
348
- "name": "file",
349
- "type": "string | undefined",
350
- "description": "Absolute path to the file that was updated, when applicable."
351
- }
352
- ]
353
- },
354
- {
355
- "id": "concept-ProjectRootResult",
356
- "name": "ProjectRootResult",
357
- "what": "Result of project root detection.",
358
- "properties": [
359
- {
360
- "name": "found",
361
- "type": "boolean",
362
- "description": "Whether a project root was found."
363
- },
364
- {
365
- "name": "root",
366
- "type": "string",
367
- "description": "The resolved project root directory, or the original cwd if not found."
368
- },
369
- {
370
- "name": "marker",
371
- "type": "string | undefined",
372
- "description": "Which marker file was found."
373
- },
374
- {
375
- "name": "hasConfig",
376
- "type": "boolean",
377
- "description": "Whether the directory has a VersionGuard config."
378
- },
379
- {
380
- "name": "hasGit",
381
- "type": "boolean",
382
- "description": "Whether the directory is inside a git repository."
383
- },
384
- {
385
- "name": "hasManifest",
386
- "type": "boolean",
387
- "description": "Whether a version manifest file exists."
388
- }
389
- ]
390
- },
391
- {
392
- "id": "concept-InitOptions",
393
- "name": "InitOptions",
394
- "what": "Options for headless (non-interactive) initialization.",
395
- "properties": [
396
- {
397
- "name": "cwd",
398
- "type": "string",
399
- "description": "Working directory path."
400
- },
401
- {
402
- "name": "type",
403
- "type": "\\"semver\\" | \\"calver\\" | undefined",
404
- "description": "Versioning type (semver or calver)."
405
- },
406
- {
407
- "name": "format",
408
- "type": "string | undefined",
409
- "description": "CalVer format string."
410
- },
411
- {
412
- "name": "manifest",
413
- "type": "string | undefined",
414
- "description": "Manifest source type."
415
- },
416
- {
417
- "name": "hooks",
418
- "type": "boolean | undefined",
419
- "description": "Whether to install git hooks."
420
- },
421
- {
422
- "name": "changelog",
423
- "type": "boolean | undefined",
424
- "description": "Whether to enable changelog validation."
425
- },
426
- {
427
- "name": "yes",
428
- "type": "boolean | undefined",
429
- "description": "Accept defaults without prompting."
430
- },
431
- {
432
- "name": "force",
433
- "type": "boolean | undefined",
434
- "description": "Overwrite existing config."
435
- }
436
- ]
437
- }
438
- ],
439
- "operations": [
440
- {
441
- "id": "op-validate",
442
- "name": "validate",
443
- "what": "Validates a CalVer string against formatting and date rules.",
444
- "inputs": [
445
- {
446
- "name": "version",
447
- "type": "unknown",
448
- "required": true,
449
- "description": "Version string to validate."
450
- },
451
- {
452
- "name": "calverFormat",
453
- "type": "unknown",
454
- "required": true,
455
- "description": "Format expected for the version string."
456
- },
457
- {
458
- "name": "preventFutureDates",
459
- "type": "unknown",
460
- "required": true,
461
- "description": "Whether future dates should be reported as errors."
462
- },
463
- {
464
- "name": "schemeRules",
465
- "type": "unknown",
466
- "required": true,
467
- "description": "Optional scheme rules for modifier validation and segment count warnings."
468
- }
469
- ],
470
- "outputs": {
471
- "text": "A validation result containing any discovered errors and the parsed version on success."
472
- }
473
- },
474
- {
475
- "id": "op-validateChangelog",
476
- "name": "validateChangelog",
477
- "what": "Validates a changelog file for release readiness.",
478
- "inputs": [
479
- {
480
- "name": "changelogPath",
481
- "type": "unknown",
482
- "required": true,
483
- "description": "Path to the changelog file."
484
- },
485
- {
486
- "name": "version",
487
- "type": "unknown",
488
- "required": true,
489
- "description": "Version that must be present in the changelog."
490
- },
491
- {
492
- "name": "strict",
493
- "type": "unknown",
494
- "required": true,
495
- "description": "Whether to require compare links and dated release headings."
496
- },
497
- {
498
- "name": "requireEntry",
499
- "type": "unknown",
500
- "required": true,
501
- "description": "Whether the requested version must already have an entry."
502
- }
503
- ],
504
- "outputs": {
505
- "text": "The result of validating the changelog file."
506
- }
507
- },
508
- {
509
- "id": "op-checkHardcodedVersions",
510
- "name": "checkHardcodedVersions",
511
- "what": "Checks configured files for hardcoded version mismatches.",
512
- "inputs": [
513
- {
514
- "name": "expectedVersion",
515
- "type": "unknown",
516
- "required": true,
517
- "description": "Version all matching entries should use."
518
- },
519
- {
520
- "name": "config",
521
- "type": "unknown",
522
- "required": true,
523
- "description": "Sync configuration describing files and replacement patterns."
524
- },
525
- {
526
- "name": "ignorePatterns",
527
- "type": "unknown",
528
- "required": true,
529
- "description": "Glob patterns to exclude while scanning."
530
- },
531
- {
532
- "name": "cwd",
533
- "type": "unknown",
534
- "required": true,
535
- "description": "Project directory used to resolve file globs."
536
- }
537
- ],
538
- "outputs": {
539
- "text": "A list of detected version mismatches."
540
- }
541
- },
542
- {
543
- "id": "op-generateHookScript",
544
- "name": "generateHookScript",
545
- "what": "Generates the shell script content for a Git hook.",
546
- "inputs": [
547
- {
548
- "name": "hookName",
549
- "type": "unknown",
550
- "required": true,
551
- "description": "Name of the Git hook to generate."
552
- }
553
- ],
554
- "outputs": {
555
- "text": "Executable shell script contents for the hook."
556
- }
557
- },
558
- {
559
- "id": "op-checkHooksPathOverride",
560
- "name": "checkHooksPathOverride",
561
- "what": "Checks whether git hooks have been redirected away from the repository.",
562
- "inputs": [
563
- {
564
- "name": "cwd",
565
- "type": "unknown",
566
- "required": true,
567
- "description": "Repository directory to inspect."
568
- }
569
- ],
570
- "outputs": {
571
- "text": "A guard warning when a hooksPath override is detected."
572
- }
573
- },
574
- {
575
- "id": "op-checkHuskyBypass",
576
- "name": "checkHuskyBypass",
577
- "what": "Checks whether the HUSKY environment variable is disabling hooks.",
578
- "inputs": [],
579
- "outputs": {
580
- "text": "A guard warning when the HUSKY bypass is detected."
581
- }
582
- },
583
- {
584
- "id": "op-checkHookIntegrity",
585
- "name": "checkHookIntegrity",
586
- "what": "Verifies that installed hook scripts match the expected content.",
587
- "inputs": [
588
- {
589
- "name": "config",
590
- "type": "unknown",
591
- "required": true,
592
- "description": "VersionGuard configuration that defines which hooks should exist."
593
- },
594
- {
595
- "name": "cwd",
596
- "type": "unknown",
597
- "required": true,
598
- "description": "Repository directory to inspect."
599
- }
600
- ],
601
- "outputs": {
602
- "text": "Guard warnings for each hook that has been tampered with."
603
- }
604
- },
605
- {
606
- "id": "op-checkEnforceHooksPolicy",
607
- "name": "checkEnforceHooksPolicy",
608
- "what": "Checks whether hooks are configured as required but not enforced.",
609
- "inputs": [
610
- {
611
- "name": "config",
612
- "type": "unknown",
613
- "required": true,
614
- "description": "VersionGuard configuration to inspect."
615
- }
616
- ],
617
- "outputs": {
618
- "text": "A guard warning when hooks are enabled but not enforced."
619
- }
620
- },
621
- {
622
- "id": "op-runGuardChecks",
623
- "name": "runGuardChecks",
624
- "what": "Runs all guard checks and returns a consolidated report.",
625
- "inputs": [
626
- {
627
- "name": "config",
628
- "type": "unknown",
629
- "required": true,
630
- "description": "VersionGuard configuration."
631
- },
632
- {
633
- "name": "cwd",
634
- "type": "unknown",
635
- "required": true,
636
- "description": "Repository directory to inspect."
637
- }
638
- ],
639
- "outputs": {
640
- "text": "A guard report with all findings."
641
- }
642
- },
643
- {
644
- "id": "op-initConfig",
645
- "name": "initConfig",
646
- "what": "Initializes a new VersionGuard config file in a project.",
647
- "inputs": [
648
- {
649
- "name": "cwd",
650
- "type": "unknown",
651
- "required": true,
652
- "description": "Project directory where the config should be created."
653
- }
654
- ],
655
- "outputs": {
656
- "text": "The path to the created config file."
657
- }
658
- },
659
- {
660
- "id": "op-createTag",
661
- "name": "createTag",
662
- "what": "Creates a release tag and optionally fixes version state first.",
663
- "inputs": [
664
- {
665
- "name": "version",
666
- "type": "unknown",
667
- "required": true,
668
- "description": "Version to embed in the new tag name."
669
- },
670
- {
671
- "name": "message",
672
- "type": "unknown",
673
- "required": true,
674
- "description": "Custom annotated tag message."
675
- },
676
- {
677
- "name": "autoFix",
678
- "type": "unknown",
679
- "required": true,
680
- "description": "Whether to auto-fix version mismatches before tagging."
681
- },
682
- {
683
- "name": "config",
684
- "type": "unknown",
685
- "required": true,
686
- "description": "Loaded VersionGuard configuration used for validation and fixes."
687
- },
688
- {
689
- "name": "cwd",
690
- "type": "unknown",
691
- "required": true,
692
- "description": "Repository directory where git commands should run."
693
- }
694
- ],
695
- "outputs": {
696
- "text": "The tagging outcome and any actions performed along the way."
697
- }
698
- },
699
- {
700
- "id": "op-validateTagForPush",
701
- "name": "validateTagForPush",
702
- "what": "Validates that a local tag is safe to push to the default remote.",
703
- "inputs": [
704
- {
705
- "name": "tagName",
706
- "type": "unknown",
707
- "required": true,
708
- "description": "Name of the tag to validate."
709
- },
710
- {
711
- "name": "cwd",
712
- "type": "unknown",
713
- "required": true,
714
- "description": "Repository directory where git commands should run."
715
- }
716
- ],
717
- "outputs": {
718
- "text": "A validation result with an optional suggested fix command."
719
- }
720
- },
721
- {
722
- "id": "op-validateVersion",
723
- "name": "validateVersion",
724
- "what": "Validates a version string against the active versioning strategy.",
725
- "inputs": [
726
- {
727
- "name": "version",
728
- "type": "unknown",
729
- "required": true,
730
- "description": "Version string to validate."
731
- },
732
- {
733
- "name": "config",
734
- "type": "unknown",
735
- "required": true,
736
- "description": "VersionGuard configuration that selects the validation rules."
737
- }
738
- ],
739
- "outputs": {
740
- "text": "The validation result for the provided version."
741
- }
742
- },
743
- {
744
- "id": "op-runWizard",
745
- "name": "runWizard",
746
- "what": "Runs the interactive setup wizard.",
747
- "inputs": [
748
- {
749
- "name": "cwd",
750
- "type": "unknown",
751
- "required": true,
752
- "description": "Project directory to initialize."
753
- }
754
- ],
755
- "outputs": {
756
- "text": "The path to the created config file, or \`null\` if cancelled."
757
- }
758
- },
759
- {
760
- "id": "op-runHeadless",
761
- "name": "runHeadless",
762
- "what": "Initializes VersionGuard non-interactively using CLI flags.",
763
- "inputs": [
764
- {
765
- "name": "options",
766
- "type": "unknown",
767
- "required": true,
768
- "description": "Headless initialization options."
769
- }
770
- ],
771
- "outputs": {
772
- "text": "The path to the created config file."
773
- }
774
- },
775
- {
776
- "id": "op-createProgram",
777
- "name": "createProgram",
778
- "what": "Creates the VersionGuard CLI program definition.",
779
- "inputs": [],
780
- "outputs": {
781
- "text": "A configured Commander program for the VersionGuard CLI."
782
- }
783
- },
784
- {
785
- "id": "op-runCli",
786
- "name": "runCli",
787
- "what": "Parses CLI arguments and executes the matching command.",
788
- "inputs": [
789
- {
790
- "name": "argv",
791
- "type": "unknown",
792
- "required": true,
793
- "description": "Full argument vector to parse."
794
- }
795
- ]
796
- },
797
- {
798
- "id": "op-createTempProject",
799
- "name": "createTempProject",
800
- "what": "Creates a temporary project directory with a minimal \`package.json\` fixture.",
801
- "inputs": [],
802
- "outputs": {
803
- "text": "The absolute path to the temporary project directory."
804
- }
805
- },
806
- {
807
- "id": "op-initGitRepo",
808
- "name": "initGitRepo",
809
- "what": "Initializes a git repository in a fixture directory with a first commit.",
810
- "inputs": [
811
- {
812
- "name": "cwd",
813
- "type": "unknown",
814
- "required": true,
815
- "description": "Absolute path to the fixture repository."
816
- }
817
- ]
818
- },
819
- {
820
- "id": "op-createBareRemote",
821
- "name": "createBareRemote",
822
- "what": "Creates a bare git repository to use as a remote in integration tests.",
823
- "inputs": [],
824
- "outputs": {
825
- "text": "The absolute path to the new bare repository."
826
- }
827
- }
828
- ],
829
- "constraints": [],
830
- "workflows": [],
831
- "configSchema": [
832
- {
833
- "key": "ManifestConfig.source",
834
- "type": "ManifestSourceType",
835
- "description": "Manifest file to read the version from. Use \`'auto'\` for file-existence detection or a specific filename.",
836
- "default": "'auto'"
837
- },
838
- {
839
- "key": "ManifestConfig.path",
840
- "type": "string | undefined",
841
- "description": "Dotted key path to the version field within the manifest. For example \`'version'\` for package.json, \`'package.version'\` for Cargo.toml, or \`'project.version'\` for pyproject.toml.",
842
- "default": "undefined (uses the provider's built-in default)"
843
- },
844
- {
845
- "key": "ManifestConfig.regex",
846
- "type": "string | undefined",
847
- "description": "Regex pattern to extract the version from source-code manifests. Capture group 1 must contain the version string.",
848
- "default": "undefined"
849
- },
850
- {
851
- "key": "CalVerConfig.format",
852
- "type": "CalVerFormat",
853
- "description": "Calendar format used when parsing and validating versions."
854
- },
855
- {
856
- "key": "CalVerConfig.preventFutureDates",
857
- "type": "boolean",
858
- "description": "Rejects versions that point to a future date.",
859
- "default": "true"
860
- },
861
- {
862
- "key": "CalVerConfig.strictMutualExclusion",
863
- "type": "boolean | undefined",
864
- "description": "Enforces that week tokens (WW/0W) cannot be mixed with month/day tokens.",
865
- "default": "true"
866
- },
867
- {
868
- "key": "SyncConfig.files",
869
- "type": "string[]",
870
- "description": "File globs or paths that should be scanned for version updates."
871
- },
872
- {
873
- "key": "SyncConfig.patterns",
874
- "type": "SyncPattern[]",
875
- "description": "Replacement patterns applied to matching files."
876
- },
877
- {
878
- "key": "ChangelogConfig.enabled",
879
- "type": "boolean",
880
- "description": "Enables changelog validation.",
881
- "default": "false"
882
- },
883
- {
884
- "key": "ChangelogConfig.file",
885
- "type": "string",
886
- "description": "Path to the changelog file to inspect."
887
- },
888
- {
889
- "key": "ChangelogConfig.strict",
890
- "type": "boolean",
891
- "description": "Treats changelog problems as hard failures.",
892
- "default": "false"
893
- },
894
- {
895
- "key": "ChangelogConfig.requireEntry",
896
- "type": "boolean",
897
- "description": "Requires an entry for the current version.",
898
- "default": "false"
899
- },
900
- {
901
- "key": "GitHooksConfig.'pre-commit'",
902
- "type": "boolean",
903
- "description": "Enables validation during the \`pre-commit\` hook.",
904
- "default": "false"
905
- },
906
- {
907
- "key": "GitHooksConfig.'pre-push'",
908
- "type": "boolean",
909
- "description": "Enables validation during the \`pre-push\` hook.",
910
- "default": "false"
911
- },
912
- {
913
- "key": "GitHooksConfig.'post-tag'",
914
- "type": "boolean",
915
- "description": "Enables follow-up tasks after a tag is created.",
916
- "default": "false"
917
- },
918
- {
919
- "key": "GitConfig.hooks",
920
- "type": "GitHooksConfig",
921
- "description": "Hook toggles used by the CLI and validation workflow."
922
- },
923
- {
924
- "key": "GitConfig.enforceHooks",
925
- "type": "boolean",
926
- "description": "Fails validation when required hooks are missing.",
927
- "default": "false"
928
- },
929
- {
930
- "key": "VersioningConfig.type",
931
- "type": "VersioningType",
932
- "description": "Versioning strategy used for the project."
933
- },
934
- {
935
- "key": "VersioningConfig.schemeRules",
936
- "type": "SchemeRules | undefined",
937
- "description": "Scheme-level validation rules applied regardless of versioning type.",
938
- "default": "\`{ maxNumericSegments: 3, allowedModifiers: ['dev', 'alpha', 'beta', 'rc'] }\`"
939
- },
940
- {
941
- "key": "VersioningConfig.calver",
942
- "type": "CalVerConfig | undefined",
943
- "description": "CalVer-specific settings when \`type\` is \`'calver'\`.",
944
- "default": "undefined"
945
- },
946
- {
947
- "key": "VersionGuardConfig.versioning",
948
- "type": "VersioningConfig",
949
- "description": "Active versioning settings."
950
- },
951
- {
952
- "key": "VersionGuardConfig.manifest",
953
- "type": "ManifestConfig",
954
- "description": "Version source manifest settings.",
955
- "default": "\`{ source: 'auto' }\`"
956
- },
957
- {
958
- "key": "VersionGuardConfig.sync",
959
- "type": "SyncConfig",
960
- "description": "Synchronization settings for mirrored version strings."
961
- },
962
- {
963
- "key": "VersionGuardConfig.changelog",
964
- "type": "ChangelogConfig",
965
- "description": "Changelog validation settings."
966
- },
967
- {
968
- "key": "VersionGuardConfig.git",
969
- "type": "GitConfig",
970
- "description": "Git enforcement settings."
971
- },
972
- {
973
- "key": "VersionGuardConfig.ignore",
974
- "type": "string[]",
975
- "description": "Files or patterns excluded from validation."
976
- },
977
- {
978
- "key": "InitOptions.cwd",
979
- "type": "string",
980
- "description": "Working directory path."
981
- },
982
- {
983
- "key": "InitOptions.type",
984
- "type": "\\"semver\\" | \\"calver\\" | undefined",
985
- "description": "Versioning type (semver or calver)."
986
- },
987
- {
988
- "key": "InitOptions.format",
989
- "type": "string | undefined",
990
- "description": "CalVer format string."
991
- },
992
- {
993
- "key": "InitOptions.manifest",
994
- "type": "string | undefined",
995
- "description": "Manifest source type."
996
- },
997
- {
998
- "key": "InitOptions.hooks",
999
- "type": "boolean | undefined",
1000
- "description": "Whether to install git hooks."
1001
- },
1002
- {
1003
- "key": "InitOptions.changelog",
1004
- "type": "boolean | undefined",
1005
- "description": "Whether to enable changelog validation."
1006
- },
1007
- {
1008
- "key": "InitOptions.yes",
1009
- "type": "boolean | undefined",
1010
- "description": "Accept defaults without prompting."
1011
- },
1012
- {
1013
- "key": "InitOptions.force",
1014
- "type": "boolean | undefined",
1015
- "description": "Overwrite existing config."
1016
- }
1017
- ]
1018
- }
1019
- `;
1020
- const llmsRaw = "# @codluv/versionguard\n> Strict versioning enforcement for SemVer and CalVer with git hooks, changelog validation, and file sync from package.json\n> Version: 0.4.0\n\n## Install\n\n```bash\nnpm install -D @codluv/versionguard\n```\n\n## Documentation\n\n- [API Reference](./api-reference.mdx): Full API documentation (MDX)\n- [Full Context](./llms-full.txt): Complete symbol documentation for deep LLM consumption\n\n## Packages\n\n### main\n90 functions, 42 types\n\n- getCalVerConfig() — Extracts the CalVer config from a VersionGuard config, throwing if missing.\n- isValidCalVerFormat() — Validates that a CalVer format string is composed of valid tokens and follows structural rules.\n- parseFormat() — Breaks a CalVer format string into its component tokens.\n- getRegexForFormat() — Builds a regular expression that matches a supported CalVer format.\n- parse() — Parses a CalVer string using the supplied format.\n- validate() — Validates a CalVer string against formatting and date rules.\n- format() — Formats a parsed CalVer object back into a version string.\n- getCurrentVersion() — Creates the current CalVer string for a format.\n- compare() — Compares two CalVer strings using a shared format.\n- increment() — Increments a CalVer string.\n- getNextVersions() — Returns the most likely next CalVer candidates.\n- validateChangelog() — Validates a changelog file for release readiness.\n- getLatestVersion() — Gets the most recent released version from a changelog.\n- addVersionEntry() — Inserts a new version entry beneath the `[Unreleased]` section.\n- isChangesetMangled() — Detects whether a changelog has been mangled by Changesets.\n- fixChangesetMangling() — Fixes a Changesets-mangled changelog into proper Keep a Changelog format.\n- parse() — Parses a semantic version string.\n- validate() — Validates that a string is a supported semantic version.\n- compare() — Compares two semantic version strings.\n- gt() — Checks whether one semantic version is greater than another.\n- lt() — Checks whether one semantic version is less than another.\n- eq() — Checks whether two semantic versions are equal in precedence.\n- increment() — Increments a semantic version string by release type.\n- format() — Formats a parsed semantic version object.\n- getVersionFeedback() — Generates actionable feedback for a version string.\n- getSyncFeedback() — Generates suggestions for version sync mismatches in a file.\n- getChangelogFeedback() — Generates suggestions for changelog-related validation issues.\n- getTagFeedback() — Generates suggestions for git tag mismatches.\n- getNestedValue() — Traverses a nested object using a dotted key path.\n- setNestedValue() — Sets a value at a dotted key path, throwing if intermediate segments are missing.\n- escapeRegExp() — Escapes special regex characters in a string for safe use in `new RegExp()`.\n- resolveVersionSource() — Resolves the version source provider for a project.\n- detectManifests() — Detects all manifest files present in a project directory.\n- getPackageJsonPath() — Gets the `package.json` path for a project directory.\n- readPackageJson() — Reads and parses a project's `package.json` file.\n- writePackageJson() — Writes a `package.json` document back to disk.\n- getPackageVersion() — Gets the version string from the project manifest. When a `manifest` config is provided, uses the configured version source provider (auto-detection or explicit). Falls back to `package.json` for backwards compatibility when no config is provided.\n- setPackageVersion() — Sets the version field in the project manifest. When a `manifest` config is provided, uses the configured version source provider. Falls back to `package.json` for backwards compatibility when no config is provided.\n- getVersionSource() — Resolves the version source provider for a project.\n- syncVersion() — Synchronizes configured files to a single version string.\n- syncFile() — Synchronizes a single file to a target version.\n- checkHardcodedVersions() — Checks configured files for hardcoded version mismatches.\n- fixPackageVersion() — Updates the `package.json` version field when needed.\n- fixSyncIssues() — Synchronizes configured files to the package version.\n- fixChangelog() — Ensures the changelog contains an entry for a version.\n- fixAll() — Runs all configured auto-fix operations.\n- suggestNextVersion() — Suggests candidate next versions for a release.\n- installHooks() — Installs VersionGuard-managed Git hooks in a repository.\n- uninstallHooks() — Removes VersionGuard-managed Git hooks from a repository.\n- findGitDir() — Finds the nearest `.git` directory by walking up from a starting directory.\n- areHooksInstalled() — Checks whether all VersionGuard-managed hooks are installed.\n- generateHookScript() — Generates the shell script content for a Git hook.\n- checkHooksPathOverride() — Checks whether git hooks have been redirected away from the repository.\n- checkHuskyBypass() — Checks whether the HUSKY environment variable is disabling hooks.\n- checkHookIntegrity() — Verifies that installed hook scripts match the expected content.\n- checkEnforceHooksPolicy() — Checks whether hooks are configured as required but not enforced.\n- runGuardChecks() — Runs all guard checks and returns a consolidated report.\n- getTopicIndex() — Returns the topic index listing.\n- getTopicContent() — Returns help content for a specific topic.\n- getLlmContext() — Returns the full API context for LLM consumption.\n- getHelpJson() — Returns the topic index as a JSON structure for machine parsing.\n- getDefaultConfig() — Returns a deep-cloned copy of the built-in VersionGuard configuration.\n- findConfig() — Finds the first supported VersionGuard config file in a directory.\n- loadConfig() — Loads a VersionGuard config file from disk.\n- getConfig() — Resolves the active VersionGuard configuration for a project.\n- initConfig() — Initializes a new VersionGuard config file in a project.\n- findProjectRoot() — Walks up from `startDir` to find the nearest project root.\n- formatNotProjectError() — Formats a helpful error message when a command can't find a project.\n- getLatestTag() — Returns the most recent reachable git tag for a repository.\n- getAllTags() — Lists all tags in a repository.\n- createTag() — Creates a release tag and optionally fixes version state first.\n- handlePostTag() — Runs post-tag validation and sync checks.\n- validateTagForPush() — Validates that a local tag is safe to push to the default remote.\n- suggestTagMessage() — Suggests an annotated tag message from changelog content.\n- validateVersion() — Validates a version string against the active versioning strategy.\n- validate() — Validates the current project state against the supplied configuration.\n- doctor() — Runs an extended readiness check for a project.\n- sync() — Synchronizes configured files to the current package version.\n- canBump() — Determines whether a project can move from one version to another.\n- runWizard() — Runs the interactive setup wizard.\n- runHeadless() — Initializes VersionGuard non-interactively using CLI flags.\n- createProgram() — Creates the VersionGuard CLI program definition.\n- runCli() — Parses CLI arguments and executes the matching command.\n- shouldRunCli() — Determines whether the current module is the invoked CLI entry point.\n- createTempProject() — Creates a temporary project directory with a minimal `package.json` fixture.\n- initGitRepo() — Initializes a git repository in a fixture directory with a first commit.\n- writeTextFile() — Writes a text fixture file relative to a temporary project directory.\n- createBareRemote() — Creates a bare git repository to use as a remote in integration tests.\n- addGitRemote() — Adds a local bare repository as the `origin` remote for a fixture repo.\n- commitAll() — Stages all changes and creates a commit in a fixture repository.\n\n- VersioningType — Supported versioning strategies.\n- ManifestSourceType — Supported manifest source types for version extraction.\n- ManifestConfig — Configures the version source manifest.\n- CalVerToken — Valid CalVer token names for building format strings.\n- CalVerFormat — A CalVer format string composed of dot-separated tokens.\n- SchemeRules — Configures scheme-level validation rules applied regardless of versioning type.\n- CalVerConfig — Configures CalVer validation rules.\n- SyncPattern — Describes a search-and-replace pattern used during version synchronization.\n- SyncConfig — Configures files and patterns that should stay in sync with the canonical version.\n- ChangelogConfig — Controls changelog validation behavior.\n- GitHooksConfig — Toggles each supported git hook integration.\n- GitConfig — Configures git-related enforcement.\n- VersioningConfig — Configures the active versioning mode.\n- VersionGuardConfig — Top-level configuration consumed by versionguard.\n- SemVer — Parsed semantic version components.\n- CalVer — Parsed calendar version components.\n- ParsedSemVer — Parsed semantic version result wrapper.\n- ParsedCalVer — Parsed calendar version result wrapper.\n- ParsedVersion — Union of supported parsed version payloads.\n- ValidationError — Describes a single validation problem.\n- ValidationResult — Result returned by version parsing and validation helpers.\n- SyncChange — Describes a single in-file version replacement.\n- SyncResult — Reports the result of synchronizing a single file.\n- VersionMismatch — Reports a discovered version mismatch.\n- FullValidationResult — Combined result from a full project validation run.\n- DoctorReport — Reports whether a project is ready to pass VersionGuard checks.\n- ParsedCalVerFormat — Parsed token layout for a supported CalVer format string.\n- ChangelogValidationResult — Describes the outcome of validating a changelog file.\n- Suggestion — Feedback entry point exports for suggestion and guidance helpers.\n- FeedbackResult — Aggregates validation errors with suggested next steps.\n- VersionSourceProvider — Abstraction for reading and writing a version string from any manifest format.\n- PackageJsonValue — JSON-compatible scalar, array, or object value used by package metadata.\n- PackageJsonArray — Recursive array type used for arbitrary JSON-compatible package values.\n- PackageJsonObject — Recursive object type used for arbitrary JSON-compatible package values.\n- PackageJson — Minimal shape of a `package.json` document used by VersionGuard.\n- FixResult — Fix entry point exports for auto-remediation helpers.\n- GuardWarning — Describes a single guard finding.\n- GuardReport — Result of a full guard check pass.\n- HelpTopic — Embedded help topics for the CLI help system.\n- ProjectRootResult — Result of project root detection.\n- TagInfo — Tag entry point exports for release-tag management helpers.\n- InitOptions — Options for headless (non-interactive) initialization.\n";
10
+ const ckmRaw = '{\n "$schema": "https://forge-ts.dev/schemas/ckm/v1.json",\n "version": "1.0.0",\n "project": "@codluv/versionguard",\n "generated": "2026-03-26T21:07:33.077Z",\n "concepts": [\n {\n "id": "concept-ManifestConfig",\n "name": "ManifestConfig",\n "what": "Configures the version source manifest.",\n "properties": [\n {\n "name": "source",\n "type": "ManifestSourceType",\n "description": "Manifest file to read the version from. Use `\'auto\'` for file-existence detection or a specific filename."\n },\n {\n "name": "path",\n "type": "string | undefined",\n "description": "Dotted key path to the version field within the manifest. For example `\'version\'` for package.json, `\'package.version\'` for Cargo.toml, or `\'project.version\'` for pyproject.toml."\n },\n {\n "name": "regex",\n "type": "string | undefined",\n "description": "Regex pattern to extract the version from source-code manifests. Capture group 1 must contain the version string."\n }\n ]\n },\n {\n "id": "concept-SemVerConfig",\n "name": "SemVerConfig",\n "what": "Configures SemVer validation rules.",\n "properties": [\n {\n "name": "allowVPrefix",\n "type": "boolean",\n "description": "Tolerates a leading `v` prefix (e.g. `v1.2.3`). When enabled the prefix is stripped before parsing."\n },\n {\n "name": "allowBuildMetadata",\n "type": "boolean",\n "description": "Permits `+build` metadata on version strings."\n },\n {\n "name": "requirePrerelease",\n "type": "boolean",\n "description": "Requires every version to carry a prerelease label."\n }\n ]\n },\n {\n "id": "concept-CalVerConfig",\n "name": "CalVerConfig",\n "what": "Configures CalVer validation rules.",\n "properties": [\n {\n "name": "format",\n "type": "CalVerFormat",\n "description": "Calendar format used when parsing and validating versions."\n },\n {\n "name": "preventFutureDates",\n "type": "boolean",\n "description": "Rejects versions that point to a future date."\n },\n {\n "name": "strictMutualExclusion",\n "type": "boolean | undefined",\n "description": "Enforces that week tokens (WW/0W) cannot be mixed with month/day tokens."\n }\n ]\n },\n {\n "id": "concept-SyncConfig",\n "name": "SyncConfig",\n "what": "Configures files and patterns that should stay in sync with the canonical version.",\n "properties": [\n {\n "name": "files",\n "type": "string[]",\n "description": "File globs or paths that should be scanned for version updates."\n },\n {\n "name": "patterns",\n "type": "SyncPattern[]",\n "description": "Replacement patterns applied to matching files."\n }\n ]\n },\n {\n "id": "concept-ChangelogConfig",\n "name": "ChangelogConfig",\n "what": "Controls changelog validation behavior.",\n "properties": [\n {\n "name": "enabled",\n "type": "boolean",\n "description": "Enables changelog validation."\n },\n {\n "name": "file",\n "type": "string",\n "description": "Path to the changelog file to inspect."\n },\n {\n "name": "strict",\n "type": "boolean",\n "description": "Treats changelog problems as hard failures."\n },\n {\n "name": "requireEntry",\n "type": "boolean",\n "description": "Requires an entry for the current version."\n },\n {\n "name": "enforceStructure",\n "type": "boolean | undefined",\n "description": "Validates that changelog section headers use only allowed names. When enabled, any `### SectionName` header not present in `sections` is reported as an error."\n },\n {\n "name": "sections",\n "type": "string[] | undefined",\n "description": "Allowed Keep a Changelog section names. Only applied when `enforceStructure` is `true`."\n }\n ]\n },\n {\n "id": "concept-GitHooksConfig",\n "name": "GitHooksConfig",\n "what": "Toggles each supported git hook integration.",\n "properties": [\n {\n "name": "\'pre-commit\'",\n "type": "boolean",\n "description": "Enables validation during the `pre-commit` hook."\n },\n {\n "name": "\'pre-push\'",\n "type": "boolean",\n "description": "Enables validation during the `pre-push` hook."\n },\n {\n "name": "\'post-tag\'",\n "type": "boolean",\n "description": "Enables follow-up tasks after a tag is created."\n }\n ]\n },\n {\n "id": "concept-GitConfig",\n "name": "GitConfig",\n "what": "Configures git-related enforcement.",\n "properties": [\n {\n "name": "hooks",\n "type": "GitHooksConfig",\n "description": "Hook toggles used by the CLI and validation workflow."\n },\n {\n "name": "enforceHooks",\n "type": "boolean",\n "description": "Fails validation when required hooks are missing."\n }\n ]\n },\n {\n "id": "concept-VersioningConfig",\n "name": "VersioningConfig",\n "what": "Configures the active versioning mode.",\n "properties": [\n {\n "name": "type",\n "type": "VersioningType",\n "description": "Versioning strategy used for the project."\n },\n {\n "name": "schemeRules",\n "type": "SchemeRules | undefined",\n "description": "Scheme-level validation rules applied regardless of versioning type."\n },\n {\n "name": "semver",\n "type": "SemVerConfig | undefined",\n "description": "SemVer-specific settings when `type` is `\'semver\'`."\n },\n {\n "name": "calver",\n "type": "CalVerConfig | undefined",\n "description": "CalVer-specific settings when `type` is `\'calver\'`."\n }\n ]\n },\n {\n "id": "concept-VersionGuardConfig",\n "name": "VersionGuardConfig",\n "what": "Top-level configuration consumed by versionguard.",\n "properties": [\n {\n "name": "versioning",\n "type": "VersioningConfig",\n "description": "Active versioning settings."\n },\n {\n "name": "manifest",\n "type": "ManifestConfig",\n "description": "Version source manifest settings."\n },\n {\n "name": "sync",\n "type": "SyncConfig",\n "description": "Synchronization settings for mirrored version strings."\n },\n {\n "name": "changelog",\n "type": "ChangelogConfig",\n "description": "Changelog validation settings."\n },\n {\n "name": "git",\n "type": "GitConfig",\n "description": "Git enforcement settings."\n },\n {\n "name": "ignore",\n "type": "string[]",\n "description": "Files or patterns excluded from validation."\n }\n ]\n },\n {\n "id": "concept-ValidationResult",\n "name": "ValidationResult",\n "what": "Result returned by version parsing and validation helpers.",\n "properties": [\n {\n "name": "valid",\n "type": "boolean",\n "description": "Indicates whether validation completed without errors."\n },\n {\n "name": "errors",\n "type": "ValidationError[]",\n "description": "Collected validation issues."\n },\n {\n "name": "version",\n "type": "ParsedVersion | undefined",\n "description": "Parsed version details when validation succeeds."\n }\n ]\n },\n {\n "id": "concept-SyncResult",\n "name": "SyncResult",\n "what": "Reports the result of synchronizing a single file.",\n "properties": [\n {\n "name": "file",\n "type": "string",\n "description": "File that was inspected or updated."\n },\n {\n "name": "updated",\n "type": "boolean",\n "description": "Indicates whether the file content changed."\n },\n {\n "name": "changes",\n "type": "SyncChange[]",\n "description": "Detailed replacements applied within the file."\n }\n ]\n },\n {\n "id": "concept-FullValidationResult",\n "name": "FullValidationResult",\n "what": "Combined result from a full project validation run.",\n "properties": [\n {\n "name": "valid",\n "type": "boolean",\n "description": "Indicates whether all checks passed."\n },\n {\n "name": "version",\n "type": "string",\n "description": "Canonical version string used for validation."\n },\n {\n "name": "versionValid",\n "type": "boolean",\n "description": "Indicates whether the root version string is valid."\n },\n {\n "name": "syncValid",\n "type": "boolean",\n "description": "Indicates whether synchronized files are in sync."\n },\n {\n "name": "changelogValid",\n "type": "boolean",\n "description": "Indicates whether changelog checks passed."\n },\n {\n "name": "errors",\n "type": "string[]",\n "description": "Human-readable validation failures collected during the run."\n }\n ]\n },\n {\n "id": "concept-ChangelogValidationResult",\n "name": "ChangelogValidationResult",\n "what": "Describes the outcome of validating a changelog file.",\n "properties": [\n {\n "name": "valid",\n "type": "boolean",\n "description": "Indicates whether the changelog satisfies all requested checks."\n },\n {\n "name": "errors",\n "type": "string[]",\n "description": "Human-readable validation errors."\n },\n {\n "name": "hasEntryForVersion",\n "type": "boolean",\n "description": "Indicates whether the changelog contains an entry for the requested version."\n }\n ]\n },\n {\n "id": "concept-ChangelogStructureOptions",\n "name": "ChangelogStructureOptions",\n "what": "Options for changelog structure enforcement.",\n "properties": [\n {\n "name": "enforceStructure",\n "type": "boolean | undefined",\n "description": "Validate section headers against an allowed list."\n },\n {\n "name": "sections",\n "type": "string[] | undefined",\n "description": "Allowed section names. Defaults to Keep a Changelog standard sections."\n }\n ]\n },\n {\n "id": "concept-CkmConfigEntry",\n "name": "CkmConfigEntry",\n "what": "A config schema entry with type, description, and default.",\n "properties": [\n {\n "name": "key",\n "type": "string",\n "description": "Dotted key path (e.g., `\'CalVerConfig.format\'`)."\n },\n {\n "name": "type",\n "type": "string",\n "description": "TypeScript type."\n },\n {\n "name": "description",\n "type": "string",\n "description": "Description from TSDoc."\n },\n {\n "name": "default",\n "type": "string | undefined",\n "description": "Default value if specified via `@defaultValue`."\n }\n ]\n },\n {\n "id": "concept-FeedbackResult",\n "name": "FeedbackResult",\n "what": "Aggregates validation errors with suggested next steps.",\n "properties": [\n {\n "name": "valid",\n "type": "boolean",\n "description": "Indicates whether the inspected version state is valid."\n },\n {\n "name": "errors",\n "type": "ValidationError[]",\n "description": "Validation errors collected during the check."\n },\n {\n "name": "suggestions",\n "type": "Suggestion[]",\n "description": "Suggested next steps for resolving the reported issues."\n },\n {\n "name": "canAutoFix",\n "type": "boolean",\n "description": "Indicates whether at least one suggestion can be auto-applied."\n }\n ]\n },\n {\n "id": "concept-FixResult",\n "name": "FixResult",\n "what": "Fix entry point exports for auto-remediation helpers.",\n "properties": [\n {\n "name": "fixed",\n "type": "boolean",\n "description": "Indicates whether the operation changed repository state."\n },\n {\n "name": "message",\n "type": "string",\n "description": "Human-readable description of the fix attempt."\n },\n {\n "name": "file",\n "type": "string | undefined",\n "description": "Absolute path to the file that was updated, when applicable."\n }\n ]\n },\n {\n "id": "concept-ProjectRootResult",\n "name": "ProjectRootResult",\n "what": "Result of project root detection.",\n "properties": [\n {\n "name": "found",\n "type": "boolean",\n "description": "Whether a project root was found."\n },\n {\n "name": "root",\n "type": "string",\n "description": "The resolved project root directory, or the original cwd if not found."\n },\n {\n "name": "marker",\n "type": "string | undefined",\n "description": "Which marker file was found."\n },\n {\n "name": "hasConfig",\n "type": "boolean",\n "description": "Whether the directory has a VersionGuard config."\n },\n {\n "name": "hasGit",\n "type": "boolean",\n "description": "Whether the directory is inside a git repository."\n },\n {\n "name": "hasManifest",\n "type": "boolean",\n "description": "Whether a version manifest file exists."\n }\n ]\n },\n {\n "id": "concept-InitOptions",\n "name": "InitOptions",\n "what": "Options for headless (non-interactive) initialization.",\n "properties": [\n {\n "name": "cwd",\n "type": "string",\n "description": "Working directory path."\n },\n {\n "name": "type",\n "type": "\\"semver\\" | \\"calver\\" | undefined",\n "description": "Versioning type (semver or calver)."\n },\n {\n "name": "format",\n "type": "string | undefined",\n "description": "CalVer format string."\n },\n {\n "name": "allowVPrefix",\n "type": "boolean | undefined",\n "description": "Allow v-prefix on SemVer versions."\n },\n {\n "name": "allowBuildMetadata",\n "type": "boolean | undefined",\n "description": "Allow build metadata on SemVer versions."\n },\n {\n "name": "requirePrerelease",\n "type": "boolean | undefined",\n "description": "Require prerelease labels on SemVer versions."\n },\n {\n "name": "manifest",\n "type": "string | undefined",\n "description": "Manifest source type."\n },\n {\n "name": "hooks",\n "type": "boolean | undefined",\n "description": "Whether to install git hooks."\n },\n {\n "name": "changelog",\n "type": "boolean | undefined",\n "description": "Whether to enable changelog validation."\n },\n {\n "name": "yes",\n "type": "boolean | undefined",\n "description": "Accept defaults without prompting."\n },\n {\n "name": "force",\n "type": "boolean | undefined",\n "description": "Overwrite existing config."\n }\n ]\n }\n ],\n "operations": [\n {\n "id": "op-validateModifier",\n "name": "validateModifier",\n "what": "Validates a pre-release / modifier tag against the allowed modifiers list.",\n "inputs": [\n {\n "name": "modifier",\n "type": "unknown",\n "required": true,\n "description": "Raw modifier string (e.g. `\\"alpha.1\\"`, `\\"rc2\\"`, `\\"dev\\"`)."\n },\n {\n "name": "schemeRules",\n "type": "unknown",\n "required": true,\n "description": "Scheme rules containing the allowed modifiers list."\n }\n ],\n "outputs": {\n "text": "A validation error when the modifier is disallowed, otherwise `null`."\n }\n },\n {\n "id": "op-validate",\n "name": "validate",\n "what": "Validates a CalVer string against formatting and date rules.",\n "inputs": [\n {\n "name": "version",\n "type": "unknown",\n "required": true,\n "description": "Version string to validate."\n },\n {\n "name": "calverFormat",\n "type": "unknown",\n "required": true,\n "description": "Format expected for the version string."\n },\n {\n "name": "preventFutureDates",\n "type": "unknown",\n "required": true,\n "description": "Whether future dates should be reported as errors."\n },\n {\n "name": "schemeRules",\n "type": "unknown",\n "required": true,\n "description": "Optional scheme rules for modifier validation and segment count warnings."\n }\n ],\n "outputs": {\n "text": "A validation result containing any discovered errors and the parsed version on success."\n }\n },\n {\n "id": "op-validateChangelog",\n "name": "validateChangelog",\n "what": "Validates a changelog file for release readiness.",\n "inputs": [\n {\n "name": "changelogPath",\n "type": "unknown",\n "required": true,\n "description": "Path to the changelog file."\n },\n {\n "name": "version",\n "type": "unknown",\n "required": true,\n "description": "Version that must be present in the changelog."\n },\n {\n "name": "strict",\n "type": "unknown",\n "required": true,\n "description": "Whether to require compare links and dated release headings."\n },\n {\n "name": "requireEntry",\n "type": "unknown",\n "required": true,\n "description": "Whether the requested version must already have an entry."\n },\n {\n "name": "structure",\n "type": "unknown",\n "required": true,\n "description": "Optional structure enforcement options."\n }\n ],\n "outputs": {\n "text": "The result of validating the changelog file."\n }\n },\n {\n "id": "op-createCkmEngine",\n "name": "createCkmEngine",\n "what": "Creates a CKM engine from a parsed manifest.",\n "inputs": [\n {\n "name": "manifest",\n "type": "unknown",\n "required": true,\n "description": "Parsed CKM manifest (from forge-ts `ckm.json`)."\n }\n ],\n "outputs": {\n "text": "A configured CKM engine."\n }\n },\n {\n "id": "op-checkHardcodedVersions",\n "name": "checkHardcodedVersions",\n "what": "Checks configured files for hardcoded version mismatches.",\n "inputs": [\n {\n "name": "expectedVersion",\n "type": "unknown",\n "required": true,\n "description": "Version all matching entries should use."\n },\n {\n "name": "config",\n "type": "unknown",\n "required": true,\n "description": "Sync configuration describing files and replacement patterns."\n },\n {\n "name": "ignorePatterns",\n "type": "unknown",\n "required": true,\n "description": "Glob patterns to exclude while scanning."\n },\n {\n "name": "cwd",\n "type": "unknown",\n "required": true,\n "description": "Project directory used to resolve file globs."\n }\n ],\n "outputs": {\n "text": "A list of detected version mismatches."\n }\n },\n {\n "id": "op-generateHookScript",\n "name": "generateHookScript",\n "what": "Generates the shell script content for a Git hook.",\n "inputs": [\n {\n "name": "hookName",\n "type": "unknown",\n "required": true,\n "description": "Name of the Git hook to generate."\n }\n ],\n "outputs": {\n "text": "Executable shell script contents for the hook."\n }\n },\n {\n "id": "op-checkHooksPathOverride",\n "name": "checkHooksPathOverride",\n "what": "Checks whether git hooks have been redirected away from the repository.",\n "inputs": [\n {\n "name": "cwd",\n "type": "unknown",\n "required": true,\n "description": "Repository directory to inspect."\n }\n ],\n "outputs": {\n "text": "A guard warning when a hooksPath override is detected."\n }\n },\n {\n "id": "op-checkHuskyBypass",\n "name": "checkHuskyBypass",\n "what": "Checks whether the HUSKY environment variable is disabling hooks.",\n "inputs": [],\n "outputs": {\n "text": "A guard warning when the HUSKY bypass is detected."\n }\n },\n {\n "id": "op-checkHookIntegrity",\n "name": "checkHookIntegrity",\n "what": "Verifies that installed hook scripts match the expected content.",\n "inputs": [\n {\n "name": "config",\n "type": "unknown",\n "required": true,\n "description": "VersionGuard configuration that defines which hooks should exist."\n },\n {\n "name": "cwd",\n "type": "unknown",\n "required": true,\n "description": "Repository directory to inspect."\n }\n ],\n "outputs": {\n "text": "Guard warnings for each hook that has been tampered with."\n }\n },\n {\n "id": "op-checkEnforceHooksPolicy",\n "name": "checkEnforceHooksPolicy",\n "what": "Checks whether hooks are configured as required but not enforced.",\n "inputs": [\n {\n "name": "config",\n "type": "unknown",\n "required": true,\n "description": "VersionGuard configuration to inspect."\n }\n ],\n "outputs": {\n "text": "A guard warning when hooks are enabled but not enforced."\n }\n },\n {\n "id": "op-runGuardChecks",\n "name": "runGuardChecks",\n "what": "Runs all guard checks and returns a consolidated report.",\n "inputs": [\n {\n "name": "config",\n "type": "unknown",\n "required": true,\n "description": "VersionGuard configuration."\n },\n {\n "name": "cwd",\n "type": "unknown",\n "required": true,\n "description": "Repository directory to inspect."\n }\n ],\n "outputs": {\n "text": "A guard report with all findings."\n }\n },\n {\n "id": "op-initConfig",\n "name": "initConfig",\n "what": "Initializes a new VersionGuard config file in a project.",\n "inputs": [\n {\n "name": "cwd",\n "type": "unknown",\n "required": true,\n "description": "Project directory where the config should be created."\n }\n ],\n "outputs": {\n "text": "The path to the created config file."\n }\n },\n {\n "id": "op-createTag",\n "name": "createTag",\n "what": "Creates a release tag and optionally fixes version state first.",\n "inputs": [\n {\n "name": "version",\n "type": "unknown",\n "required": true,\n "description": "Version to embed in the new tag name."\n },\n {\n "name": "message",\n "type": "unknown",\n "required": true,\n "description": "Custom annotated tag message."\n },\n {\n "name": "autoFix",\n "type": "unknown",\n "required": true,\n "description": "Whether to auto-fix version mismatches before tagging."\n },\n {\n "name": "config",\n "type": "unknown",\n "required": true,\n "description": "Loaded VersionGuard configuration used for validation and fixes."\n },\n {\n "name": "cwd",\n "type": "unknown",\n "required": true,\n "description": "Repository directory where git commands should run."\n }\n ],\n "outputs": {\n "text": "The tagging outcome and any actions performed along the way."\n }\n },\n {\n "id": "op-validateTagForPush",\n "name": "validateTagForPush",\n "what": "Validates that a local tag is safe to push to the default remote.",\n "inputs": [\n {\n "name": "tagName",\n "type": "unknown",\n "required": true,\n "description": "Name of the tag to validate."\n },\n {\n "name": "cwd",\n "type": "unknown",\n "required": true,\n "description": "Repository directory where git commands should run."\n }\n ],\n "outputs": {\n "text": "A validation result with an optional suggested fix command."\n }\n },\n {\n "id": "op-validateVersion",\n "name": "validateVersion",\n "what": "Validates a version string against the active versioning strategy.",\n "inputs": [\n {\n "name": "version",\n "type": "unknown",\n "required": true,\n "description": "Version string to validate."\n },\n {\n "name": "config",\n "type": "unknown",\n "required": true,\n "description": "VersionGuard configuration that selects the validation rules."\n }\n ],\n "outputs": {\n "text": "The validation result for the provided version."\n }\n },\n {\n "id": "op-runWizard",\n "name": "runWizard",\n "what": "Runs the interactive setup wizard.",\n "inputs": [\n {\n "name": "cwd",\n "type": "unknown",\n "required": true,\n "description": "Project directory to initialize."\n }\n ],\n "outputs": {\n "text": "The path to the created config file, or `null` if cancelled."\n }\n },\n {\n "id": "op-runHeadless",\n "name": "runHeadless",\n "what": "Initializes VersionGuard non-interactively using CLI flags.",\n "inputs": [\n {\n "name": "options",\n "type": "unknown",\n "required": true,\n "description": "Headless initialization options."\n }\n ],\n "outputs": {\n "text": "The path to the created config file."\n }\n },\n {\n "id": "op-createProgram",\n "name": "createProgram",\n "what": "Creates the VersionGuard CLI program definition.",\n "inputs": [],\n "outputs": {\n "text": "A configured Commander program for the VersionGuard CLI."\n }\n },\n {\n "id": "op-runCli",\n "name": "runCli",\n "what": "Parses CLI arguments and executes the matching command.",\n "inputs": [\n {\n "name": "argv",\n "type": "unknown",\n "required": true,\n "description": "Full argument vector to parse."\n }\n ]\n },\n {\n "id": "op-createTempProject",\n "name": "createTempProject",\n "what": "Creates a temporary project directory with a minimal `package.json` fixture.",\n "inputs": [],\n "outputs": {\n "text": "The absolute path to the temporary project directory."\n }\n },\n {\n "id": "op-initGitRepo",\n "name": "initGitRepo",\n "what": "Initializes a git repository in a fixture directory with a first commit.",\n "inputs": [\n {\n "name": "cwd",\n "type": "unknown",\n "required": true,\n "description": "Absolute path to the fixture repository."\n }\n ]\n },\n {\n "id": "op-createBareRemote",\n "name": "createBareRemote",\n "what": "Creates a bare git repository to use as a remote in integration tests.",\n "inputs": [],\n "outputs": {\n "text": "The absolute path to the new bare repository."\n }\n }\n ],\n "constraints": [],\n "workflows": [],\n "configSchema": [\n {\n "key": "ManifestConfig.source",\n "type": "ManifestSourceType",\n "description": "Manifest file to read the version from. Use `\'auto\'` for file-existence detection or a specific filename.",\n "default": "\'auto\'"\n },\n {\n "key": "ManifestConfig.path",\n "type": "string | undefined",\n "description": "Dotted key path to the version field within the manifest. For example `\'version\'` for package.json, `\'package.version\'` for Cargo.toml, or `\'project.version\'` for pyproject.toml.",\n "default": "undefined (uses the provider\'s built-in default)"\n },\n {\n "key": "ManifestConfig.regex",\n "type": "string | undefined",\n "description": "Regex pattern to extract the version from source-code manifests. Capture group 1 must contain the version string.",\n "default": "undefined"\n },\n {\n "key": "SemVerConfig.allowVPrefix",\n "type": "boolean",\n "description": "Tolerates a leading `v` prefix (e.g. `v1.2.3`). When enabled the prefix is stripped before parsing.",\n "default": "false"\n },\n {\n "key": "SemVerConfig.allowBuildMetadata",\n "type": "boolean",\n "description": "Permits `+build` metadata on version strings.",\n "default": "true"\n },\n {\n "key": "SemVerConfig.requirePrerelease",\n "type": "boolean",\n "description": "Requires every version to carry a prerelease label.",\n "default": "false"\n },\n {\n "key": "CalVerConfig.format",\n "type": "CalVerFormat",\n "description": "Calendar format used when parsing and validating versions."\n },\n {\n "key": "CalVerConfig.preventFutureDates",\n "type": "boolean",\n "description": "Rejects versions that point to a future date.",\n "default": "true"\n },\n {\n "key": "CalVerConfig.strictMutualExclusion",\n "type": "boolean | undefined",\n "description": "Enforces that week tokens (WW/0W) cannot be mixed with month/day tokens.",\n "default": "true"\n },\n {\n "key": "SyncConfig.files",\n "type": "string[]",\n "description": "File globs or paths that should be scanned for version updates."\n },\n {\n "key": "SyncConfig.patterns",\n "type": "SyncPattern[]",\n "description": "Replacement patterns applied to matching files."\n },\n {\n "key": "ChangelogConfig.enabled",\n "type": "boolean",\n "description": "Enables changelog validation.",\n "default": "false"\n },\n {\n "key": "ChangelogConfig.file",\n "type": "string",\n "description": "Path to the changelog file to inspect."\n },\n {\n "key": "ChangelogConfig.strict",\n "type": "boolean",\n "description": "Treats changelog problems as hard failures.",\n "default": "false"\n },\n {\n "key": "ChangelogConfig.requireEntry",\n "type": "boolean",\n "description": "Requires an entry for the current version.",\n "default": "false"\n },\n {\n "key": "ChangelogConfig.enforceStructure",\n "type": "boolean | undefined",\n "description": "Validates that changelog section headers use only allowed names. When enabled, any `### SectionName` header not present in `sections` is reported as an error.",\n "default": "false"\n },\n {\n "key": "ChangelogConfig.sections",\n "type": "string[] | undefined",\n "description": "Allowed Keep a Changelog section names. Only applied when `enforceStructure` is `true`.",\n "default": "[\'Added\', \'Changed\', \'Deprecated\', \'Removed\', \'Fixed\', \'Security\']"\n },\n {\n "key": "GitHooksConfig.\'pre-commit\'",\n "type": "boolean",\n "description": "Enables validation during the `pre-commit` hook.",\n "default": "false"\n },\n {\n "key": "GitHooksConfig.\'pre-push\'",\n "type": "boolean",\n "description": "Enables validation during the `pre-push` hook.",\n "default": "false"\n },\n {\n "key": "GitHooksConfig.\'post-tag\'",\n "type": "boolean",\n "description": "Enables follow-up tasks after a tag is created.",\n "default": "false"\n },\n {\n "key": "GitConfig.hooks",\n "type": "GitHooksConfig",\n "description": "Hook toggles used by the CLI and validation workflow."\n },\n {\n "key": "GitConfig.enforceHooks",\n "type": "boolean",\n "description": "Fails validation when required hooks are missing.",\n "default": "false"\n },\n {\n "key": "VersioningConfig.type",\n "type": "VersioningType",\n "description": "Versioning strategy used for the project."\n },\n {\n "key": "VersioningConfig.schemeRules",\n "type": "SchemeRules | undefined",\n "description": "Scheme-level validation rules applied regardless of versioning type.",\n "default": "`{ maxNumericSegments: 3, allowedModifiers: [\'dev\', \'alpha\', \'beta\', \'rc\'] }`"\n },\n {\n "key": "VersioningConfig.semver",\n "type": "SemVerConfig | undefined",\n "description": "SemVer-specific settings when `type` is `\'semver\'`.",\n "default": "`{ allowVPrefix: false, allowBuildMetadata: true, requirePrerelease: false }`"\n },\n {\n "key": "VersioningConfig.calver",\n "type": "CalVerConfig | undefined",\n "description": "CalVer-specific settings when `type` is `\'calver\'`.",\n "default": "undefined"\n },\n {\n "key": "VersionGuardConfig.versioning",\n "type": "VersioningConfig",\n "description": "Active versioning settings."\n },\n {\n "key": "VersionGuardConfig.manifest",\n "type": "ManifestConfig",\n "description": "Version source manifest settings.",\n "default": "`{ source: \'auto\' }`"\n },\n {\n "key": "VersionGuardConfig.sync",\n "type": "SyncConfig",\n "description": "Synchronization settings for mirrored version strings."\n },\n {\n "key": "VersionGuardConfig.changelog",\n "type": "ChangelogConfig",\n "description": "Changelog validation settings."\n },\n {\n "key": "VersionGuardConfig.git",\n "type": "GitConfig",\n "description": "Git enforcement settings."\n },\n {\n "key": "VersionGuardConfig.ignore",\n "type": "string[]",\n "description": "Files or patterns excluded from validation."\n },\n {\n "key": "ChangelogStructureOptions.enforceStructure",\n "type": "boolean | undefined",\n "description": "Validate section headers against an allowed list."\n },\n {\n "key": "ChangelogStructureOptions.sections",\n "type": "string[] | undefined",\n "description": "Allowed section names. Defaults to Keep a Changelog standard sections."\n },\n {\n "key": "CkmConfigEntry.key",\n "type": "string",\n "description": "Dotted key path (e.g., `\'CalVerConfig.format\'`)."\n },\n {\n "key": "CkmConfigEntry.type",\n "type": "string",\n "description": "TypeScript type."\n },\n {\n "key": "CkmConfigEntry.description",\n "type": "string",\n "description": "Description from TSDoc."\n },\n {\n "key": "CkmConfigEntry.default",\n "type": "string | undefined",\n "description": "Default value if specified via `@defaultValue`."\n },\n {\n "key": "InitOptions.cwd",\n "type": "string",\n "description": "Working directory path."\n },\n {\n "key": "InitOptions.type",\n "type": "\\"semver\\" | \\"calver\\" | undefined",\n "description": "Versioning type (semver or calver)."\n },\n {\n "key": "InitOptions.format",\n "type": "string | undefined",\n "description": "CalVer format string."\n },\n {\n "key": "InitOptions.allowVPrefix",\n "type": "boolean | undefined",\n "description": "Allow v-prefix on SemVer versions."\n },\n {\n "key": "InitOptions.allowBuildMetadata",\n "type": "boolean | undefined",\n "description": "Allow build metadata on SemVer versions."\n },\n {\n "key": "InitOptions.requirePrerelease",\n "type": "boolean | undefined",\n "description": "Require prerelease labels on SemVer versions."\n },\n {\n "key": "InitOptions.manifest",\n "type": "string | undefined",\n "description": "Manifest source type."\n },\n {\n "key": "InitOptions.hooks",\n "type": "boolean | undefined",\n "description": "Whether to install git hooks."\n },\n {\n "key": "InitOptions.changelog",\n "type": "boolean | undefined",\n "description": "Whether to enable changelog validation."\n },\n {\n "key": "InitOptions.yes",\n "type": "boolean | undefined",\n "description": "Accept defaults without prompting."\n },\n {\n "key": "InitOptions.force",\n "type": "boolean | undefined",\n "description": "Overwrite existing config."\n }\n ]\n}';
11
+ const llmsRaw = "# @codluv/versionguard\n> Strict versioning enforcement for SemVer and CalVer — language-agnostic manifest support, git hooks, changelog validation, and file sync\n> Version: 0.6.0\n\n## Install\n\n```bash\nnpm install -D @codluv/versionguard\n```\n\n## Documentation\n\n- [API Reference](./api-reference.mdx): Full API documentation (MDX)\n- [Full Context](./llms-full.txt): Complete symbol documentation for deep LLM consumption\n\n## Packages\n\n### main\n89 functions, 53 types\n\n- getSemVerConfig() — Resolves the SemVer config from a VersionGuard config.\n- getCalVerConfig() — Extracts the CalVer config from a VersionGuard config, throwing if missing.\n- validateModifier() — Validates a pre-release / modifier tag against the allowed modifiers list.\n- isValidCalVerFormat() — Validates that a CalVer format string is composed of valid tokens and follows structural rules.\n- parseFormat() — Breaks a CalVer format string into its component tokens.\n- getRegexForFormat() — Builds a regular expression that matches a supported CalVer format.\n- parse() — Parses a CalVer string using the supplied format.\n- validate() — Validates a CalVer string against formatting and date rules.\n- format() — Formats a parsed CalVer object back into a version string.\n- getCurrentVersion() — Creates the current CalVer string for a format.\n- compare() — Compares two CalVer strings using a shared format.\n- increment() — Increments a CalVer string.\n- getNextVersions() — Returns the most likely next CalVer candidates.\n- validateChangelog() — Validates a changelog file for release readiness.\n- getLatestVersion() — Gets the most recent released version from a changelog.\n- addVersionEntry() — Inserts a new version entry beneath the `[Unreleased]` section.\n- isChangesetMangled() — Detects whether a changelog has been mangled by Changesets.\n- fixChangesetMangling() — Fixes a Changesets-mangled changelog into proper Keep a Changelog format.\n- createCkmEngine() — Creates a CKM engine from a parsed manifest.\n- parse() — Parses a semantic version string.\n- validate() — Validates that a string is a supported semantic version.\n- compare() — Compares two semantic version strings.\n- gt() — Checks whether one semantic version is greater than another.\n- lt() — Checks whether one semantic version is less than another.\n- eq() — Checks whether two semantic versions are equal in precedence.\n- increment() — Increments a semantic version string by release type.\n- format() — Formats a parsed semantic version object.\n- getVersionFeedback() — Generates actionable feedback for a version string.\n- getSyncFeedback() — Generates suggestions for version sync mismatches in a file.\n- getChangelogFeedback() — Generates suggestions for changelog-related validation issues.\n- getTagFeedback() — Generates suggestions for git tag mismatches.\n- getNestedValue() — Traverses a nested object using a dotted key path.\n- setNestedValue() — Sets a value at a dotted key path, throwing if intermediate segments are missing.\n- escapeRegExp() — Escapes special regex characters in a string for safe use in `new RegExp()`.\n- resolveVersionSource() — Resolves the version source provider for a project.\n- detectManifests() — Detects all manifest files present in a project directory.\n- getPackageJsonPath() — Gets the `package.json` path for a project directory.\n- readPackageJson() — Reads and parses a project's `package.json` file.\n- writePackageJson() — Writes a `package.json` document back to disk.\n- getPackageVersion() — Gets the version string from the project manifest. When a `manifest` config is provided, uses the configured version source provider (auto-detection or explicit). Falls back to `package.json` for backwards compatibility when no config is provided.\n- setPackageVersion() — Sets the version field in the project manifest. When a `manifest` config is provided, uses the configured version source provider. Falls back to `package.json` for backwards compatibility when no config is provided.\n- getVersionSource() — Resolves the version source provider for a project.\n- syncVersion() — Synchronizes configured files to a single version string.\n- syncFile() — Synchronizes a single file to a target version.\n- checkHardcodedVersions() — Checks configured files for hardcoded version mismatches.\n- fixPackageVersion() — Updates the `package.json` version field when needed.\n- fixSyncIssues() — Synchronizes configured files to the package version.\n- fixChangelog() — Ensures the changelog contains an entry for a version.\n- fixAll() — Runs all configured auto-fix operations.\n- suggestNextVersion() — Suggests candidate next versions for a release.\n- installHooks() — Installs VersionGuard-managed Git hooks in a repository.\n- uninstallHooks() — Removes VersionGuard-managed Git hooks from a repository.\n- findGitDir() — Finds the nearest `.git` directory by walking up from a starting directory.\n- areHooksInstalled() — Checks whether all VersionGuard-managed hooks are installed.\n- generateHookScript() — Generates the shell script content for a Git hook.\n- checkHooksPathOverride() — Checks whether git hooks have been redirected away from the repository.\n- checkHuskyBypass() — Checks whether the HUSKY environment variable is disabling hooks.\n- checkHookIntegrity() — Verifies that installed hook scripts match the expected content.\n- checkEnforceHooksPolicy() — Checks whether hooks are configured as required but not enforced.\n- runGuardChecks() — Runs all guard checks and returns a consolidated report.\n- getDefaultConfig() — Returns a deep-cloned copy of the built-in VersionGuard configuration.\n- findConfig() — Finds the first supported VersionGuard config file in a directory.\n- loadConfig() — Loads a VersionGuard config file from disk.\n- getConfig() — Resolves the active VersionGuard configuration for a project.\n- initConfig() — Initializes a new VersionGuard config file in a project.\n- findProjectRoot() — Walks up from `startDir` to find the nearest project root.\n- formatNotProjectError() — Formats a helpful error message when a command can't find a project.\n- getLatestTag() — Returns the most recent reachable git tag for a repository.\n- getAllTags() — Lists all tags in a repository.\n- createTag() — Creates a release tag and optionally fixes version state first.\n- handlePostTag() — Runs post-tag validation and sync checks.\n- validateTagForPush() — Validates that a local tag is safe to push to the default remote.\n- suggestTagMessage() — Suggests an annotated tag message from changelog content.\n- validateVersion() — Validates a version string against the active versioning strategy.\n- validate() — Validates the current project state against the supplied configuration.\n- doctor() — Runs an extended readiness check for a project.\n- sync() — Synchronizes configured files to the current package version.\n- canBump() — Determines whether a project can move from one version to another.\n- runWizard() — Runs the interactive setup wizard.\n- runHeadless() — Initializes VersionGuard non-interactively using CLI flags.\n- createProgram() — Creates the VersionGuard CLI program definition.\n- runCli() — Parses CLI arguments and executes the matching command.\n- shouldRunCli() — Determines whether the current module is the invoked CLI entry point.\n- createTempProject() — Creates a temporary project directory with a minimal `package.json` fixture.\n- initGitRepo() — Initializes a git repository in a fixture directory with a first commit.\n- writeTextFile() — Writes a text fixture file relative to a temporary project directory.\n- createBareRemote() — Creates a bare git repository to use as a remote in integration tests.\n- addGitRemote() — Adds a local bare repository as the `origin` remote for a fixture repo.\n- commitAll() — Stages all changes and creates a commit in a fixture repository.\n\n- VersioningType — Supported versioning strategies.\n- ManifestSourceType — Supported manifest source types for version extraction.\n- ManifestConfig — Configures the version source manifest.\n- CalVerToken — Valid CalVer token names for building format strings.\n- CalVerFormat — A CalVer format string composed of dot-separated tokens.\n- SchemeRules — Configures scheme-level validation rules applied regardless of versioning type.\n- SemVerConfig — Configures SemVer validation rules.\n- CalVerConfig — Configures CalVer validation rules.\n- SyncPattern — Describes a search-and-replace pattern used during version synchronization.\n- SyncConfig — Configures files and patterns that should stay in sync with the canonical version.\n- ChangelogConfig — Controls changelog validation behavior.\n- GitHooksConfig — Toggles each supported git hook integration.\n- GitConfig — Configures git-related enforcement.\n- VersioningConfig — Configures the active versioning mode.\n- VersionGuardConfig — Top-level configuration consumed by versionguard.\n- SemVer — Parsed semantic version components.\n- CalVer — Parsed calendar version components.\n- ParsedSemVer — Parsed semantic version result wrapper.\n- ParsedCalVer — Parsed calendar version result wrapper.\n- ParsedVersion — Union of supported parsed version payloads.\n- ValidationError — Describes a single validation problem.\n- ValidationResult — Result returned by version parsing and validation helpers.\n- SyncChange — Describes a single in-file version replacement.\n- SyncResult — Reports the result of synchronizing a single file.\n- VersionMismatch — Reports a discovered version mismatch.\n- FullValidationResult — Combined result from a full project validation run.\n- DoctorReport — Reports whether a project is ready to pass VersionGuard checks.\n- ParsedCalVerFormat — Parsed token layout for a supported CalVer format string.\n- ChangelogValidationResult — Describes the outcome of validating a changelog file.\n- ChangelogStructureOptions — Options for changelog structure enforcement.\n- CkmConcept — A domain concept extracted from an exported interface or type.\n- CkmProperty — A property within a concept.\n- CkmOperation — A user-facing operation extracted from an exported function.\n- CkmInput — A function parameter within an operation.\n- CkmConstraint — A constraint enforced by the tool.\n- CkmWorkflow — A multi-step workflow for a common goal.\n- CkmConfigEntry — A config schema entry with type, description, and default.\n- CkmManifest — The complete Codebase Knowledge Manifest.\n- CkmTopic — An auto-generated topic derived from CKM data.\n- CkmEngine — The CKM engine — provides topic derivation, filtering, and output formatting.\n- Suggestion — Feedback entry point exports for suggestion and guidance helpers.\n- FeedbackResult — Aggregates validation errors with suggested next steps.\n- VersionSourceProvider — Abstraction for reading and writing a version string from any manifest format.\n- PackageJsonValue — JSON-compatible scalar, array, or object value used by package metadata.\n- PackageJsonArray — Recursive array type used for arbitrary JSON-compatible package values.\n- PackageJsonObject — Recursive object type used for arbitrary JSON-compatible package values.\n- PackageJson — Minimal shape of a `package.json` document used by VersionGuard.\n- FixResult — Fix entry point exports for auto-remediation helpers.\n- GuardWarning — Describes a single guard finding.\n- GuardReport — Result of a full guard check pass.\n- ProjectRootResult — Result of project root detection.\n- TagInfo — Tag entry point exports for release-tag management helpers.\n- InitOptions — Options for headless (non-interactive) initialization.\n";
1021
12
  async function runWizard(cwd) {
1022
13
  p.intro("VersionGuard Setup");
1023
14
  const existingConfig = findExistingConfig(cwd);
@@ -1041,6 +32,9 @@ async function runWizard(cwd) {
1041
32
  return null;
1042
33
  }
1043
34
  let format;
35
+ let allowVPrefix = false;
36
+ let allowBuildMetadata = true;
37
+ let requirePrerelease = false;
1044
38
  if (type === "calver") {
1045
39
  const selected = await selectCalVerFormat();
1046
40
  if (!selected) {
@@ -1048,6 +42,15 @@ async function runWizard(cwd) {
1048
42
  return null;
1049
43
  }
1050
44
  format = selected;
45
+ } else {
46
+ const semverOptions = await selectSemVerOptions();
47
+ if (!semverOptions) {
48
+ p.outro("Setup cancelled.");
49
+ return null;
50
+ }
51
+ allowVPrefix = semverOptions.allowVPrefix;
52
+ allowBuildMetadata = semverOptions.allowBuildMetadata;
53
+ requirePrerelease = semverOptions.requirePrerelease;
1051
54
  }
1052
55
  const manifest = await selectManifest(cwd);
1053
56
  if (manifest === null) {
@@ -1073,13 +76,16 @@ async function runWizard(cwd) {
1073
76
  const config = buildConfig({
1074
77
  type,
1075
78
  format,
79
+ allowVPrefix,
80
+ allowBuildMetadata,
81
+ requirePrerelease,
1076
82
  manifest: manifest === "auto" ? void 0 : manifest,
1077
83
  hooks,
1078
84
  changelog
1079
85
  });
1080
86
  const configPath = writeConfig(cwd, config);
1081
87
  p.log.success(`Created ${path.relative(cwd, configPath)}`);
1082
- p.outro("Run `versionguard validate` to verify your setup.");
88
+ p.outro("Run `vg validate` to verify your setup.");
1083
89
  return configPath;
1084
90
  }
1085
91
  function runHeadless(options) {
@@ -1092,6 +98,9 @@ function runHeadless(options) {
1092
98
  const config = buildConfig({
1093
99
  type: options.type ?? "semver",
1094
100
  format: options.format,
101
+ allowVPrefix: options.allowVPrefix ?? false,
102
+ allowBuildMetadata: options.allowBuildMetadata ?? true,
103
+ requirePrerelease: options.requirePrerelease ?? false,
1095
104
  manifest: options.manifest,
1096
105
  hooks: options.hooks ?? true,
1097
106
  changelog: options.changelog ?? true
@@ -1131,6 +140,32 @@ async function selectCalVerFormat() {
1131
140
  }
1132
141
  return preset;
1133
142
  }
143
+ async function selectSemVerOptions() {
144
+ const customize = await p.confirm({
145
+ message: "Customize SemVer rules? (defaults work for most projects)",
146
+ initialValue: false
147
+ });
148
+ if (p.isCancel(customize)) return null;
149
+ if (!customize) {
150
+ return { allowVPrefix: false, allowBuildMetadata: true, requirePrerelease: false };
151
+ }
152
+ const allowVPrefix = await p.confirm({
153
+ message: "Allow v-prefix? (e.g., v1.2.3)",
154
+ initialValue: false
155
+ });
156
+ if (p.isCancel(allowVPrefix)) return null;
157
+ const allowBuildMetadata = await p.confirm({
158
+ message: "Allow build metadata? (e.g., 1.2.3+build.123)",
159
+ initialValue: true
160
+ });
161
+ if (p.isCancel(allowBuildMetadata)) return null;
162
+ const requirePrerelease = await p.confirm({
163
+ message: "Require prerelease labels? (e.g., 1.2.3-alpha.1)",
164
+ initialValue: false
165
+ });
166
+ if (p.isCancel(requirePrerelease)) return null;
167
+ return { allowVPrefix, allowBuildMetadata, requirePrerelease };
168
+ }
1134
169
  async function selectManifest(cwd) {
1135
170
  const detected = [];
1136
171
  const checks = [
@@ -1162,17 +197,19 @@ async function selectManifest(cwd) {
1162
197
  return result;
1163
198
  }
1164
199
  function buildConfig(input) {
1165
- const config = {
1166
- versioning: {
1167
- type: input.type,
1168
- ...input.type === "calver" && input.format ? {
1169
- calver: {
1170
- format: input.format,
1171
- preventFutureDates: true
1172
- }
1173
- } : {}
200
+ const versioning = {
201
+ type: input.type,
202
+ semver: {
203
+ allowVPrefix: input.allowVPrefix,
204
+ allowBuildMetadata: input.allowBuildMetadata,
205
+ requirePrerelease: input.requirePrerelease
206
+ },
207
+ calver: {
208
+ format: input.format ?? "YYYY.MM.PATCH",
209
+ preventFutureDates: true
1174
210
  }
1175
211
  };
212
+ const config = { versioning };
1176
213
  if (input.manifest) {
1177
214
  config.manifest = { source: input.manifest };
1178
215
  }
@@ -1251,17 +288,20 @@ function requireProject(cwd, command) {
1251
288
  }
1252
289
  function createProgram() {
1253
290
  const program = new Command();
1254
- program.name("versionguard").description("Strict versioning enforcement for SemVer and CalVer").version(CLI_VERSION);
1255
- 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").option("--force", "Overwrite existing config file").action(
291
+ program.name("vg").description("Strict versioning enforcement for SemVer and CalVer (alias: versionguard)").version(CLI_VERSION);
292
+ 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("--allow-v-prefix", "SemVer: allow v-prefix (e.g., v1.2.3)").option("--no-build-metadata", "SemVer: disallow +build metadata").option("--require-prerelease", "SemVer: require prerelease labels").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").option("--force", "Overwrite existing config file").action(
1256
293
  async (options) => {
1257
294
  try {
1258
- const isHeadless = options.yes || options.type || options.format || options.manifest;
295
+ const isHeadless = options.yes || options.type || options.format || options.manifest || options.allowVPrefix || options.buildMetadata === false || options.requirePrerelease;
1259
296
  let configPath;
1260
297
  if (isHeadless) {
1261
298
  configPath = runHeadless({
1262
299
  cwd: options.cwd,
1263
300
  type: options.type,
1264
301
  format: options.format,
302
+ allowVPrefix: options.allowVPrefix,
303
+ allowBuildMetadata: options.buildMetadata,
304
+ requirePrerelease: options.requirePrerelease,
1265
305
  manifest: options.manifest,
1266
306
  hooks: options.hooks,
1267
307
  changelog: options.changelog,
@@ -1612,12 +652,12 @@ function createProgram() {
1612
652
  if (!content) {
1613
653
  console.error(styles.error(`Unknown topic: ${topic}`));
1614
654
  console.log("");
1615
- console.log(ckmEngine.getTopicIndex("versionguard"));
655
+ console.log(ckmEngine.getTopicIndex("vg"));
1616
656
  process.exit(1);
1617
657
  }
1618
658
  console.log(content);
1619
659
  } else {
1620
- console.log(ckmEngine.getTopicIndex("versionguard"));
660
+ console.log(ckmEngine.getTopicIndex("vg"));
1621
661
  }
1622
662
  });
1623
663
  const hooksCommand = program.command("hooks").description("Manage git hooks");