@codluv/versionguard 0.8.0 → 1.0.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/README.md +139 -58
- package/dist/chunks/src-Bofo3tVH.js +5050 -0
- package/dist/chunks/src-Bofo3tVH.js.map +1 -0
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +822 -712
- package/dist/cli.js.map +1 -1
- package/dist/config.d.ts.map +1 -1
- package/dist/github/dependabot.d.ts +62 -0
- package/dist/github/dependabot.d.ts.map +1 -0
- package/dist/github/index.d.ts +7 -0
- package/dist/github/index.d.ts.map +1 -0
- package/dist/guard.d.ts +2 -33
- package/dist/guard.d.ts.map +1 -1
- package/dist/hooks.d.ts.map +1 -1
- package/dist/index.d.ts +10 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -59
- package/dist/init-wizard.d.ts +2 -0
- package/dist/init-wizard.d.ts.map +1 -1
- package/dist/publish.d.ts +61 -0
- package/dist/publish.d.ts.map +1 -0
- package/dist/types.d.ts +209 -1
- package/dist/types.d.ts.map +1 -1
- package/package.json +12 -12
- package/dist/chunks/index-Cipg9sxE.js +0 -3086
- package/dist/chunks/index-Cipg9sxE.js.map +0 -1
- package/dist/index.js.map +0 -1
package/README.md
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
# VersionGuard
|
|
2
2
|
|
|
3
|
-
Strict version governance for
|
|
3
|
+
Strict version governance for any project — SemVer and CalVer enforcement, language-agnostic manifest support, git hooks, changelog validation, file sync, and repo-wide version scanning.
|
|
4
4
|
|
|
5
|
-
VersionGuard keeps
|
|
5
|
+
VersionGuard keeps your manifest, changelog entries, git tags, and configured version references in sync so humans and LLM agents stop shipping messy release state.
|
|
6
6
|
|
|
7
7
|
## Why it exists
|
|
8
8
|
|
|
9
9
|
Versioning breaks in the same places over and over:
|
|
10
10
|
|
|
11
|
-
- versions get hardcoded across docs and
|
|
12
|
-
- changelog entries are forgotten
|
|
11
|
+
- versions get hardcoded across docs, CI configs, and Dockerfiles
|
|
12
|
+
- changelog entries are forgotten or use wrong section names
|
|
13
13
|
- tags drift from the package version
|
|
14
14
|
- SemVer and CalVer rules get bent under pressure
|
|
15
15
|
- agents take shortcuts and leave the repo in an invalid release state
|
|
@@ -18,58 +18,78 @@ VersionGuard turns those into enforceable checks with repair-oriented feedback.
|
|
|
18
18
|
|
|
19
19
|
## What it does
|
|
20
20
|
|
|
21
|
-
- validates SemVer and CalVer formats
|
|
22
|
-
- keeps configured files synced from
|
|
23
|
-
-
|
|
24
|
-
-
|
|
25
|
-
-
|
|
21
|
+
- validates SemVer and CalVer formats with configurable rules
|
|
22
|
+
- keeps configured files synced from your manifest (package.json, Cargo.toml, pyproject.toml, etc.)
|
|
23
|
+
- scans the entire repo for stale version literals (enabled by default)
|
|
24
|
+
- verifies publish status against your package registry (npm, crates.io, PyPI, etc.)
|
|
25
|
+
- validates Keep a Changelog structure with section enforcement
|
|
26
|
+
- installs cooperative git hooks for `pre-commit`, `pre-push`, and `post-tag`
|
|
26
27
|
- provides CLI commands for validation, sync, bumps, and tagging
|
|
27
28
|
- refuses unsafe tagging when hooks are required or the worktree is dirty
|
|
29
|
+
- built-in CKM help system for humans and LLM agents (`vg ckm`)
|
|
30
|
+
|
|
31
|
+
## Where it runs
|
|
32
|
+
|
|
33
|
+
VersionGuard enforces at three points in the development lifecycle:
|
|
34
|
+
|
|
35
|
+
1. **Local dev (git hooks):** `pre-commit` and `pre-push` hooks run `vg validate` automatically. This catches version drift, changelog issues, and sync mismatches before code leaves the developer's machine. This is the primary enforcement point.
|
|
36
|
+
|
|
37
|
+
2. **CI (GitHub Actions):** `vg validate` runs as a build gate in CI. This catches anything the hooks missed (hooks can be skipped with `--no-verify`), validates on every PR, and ensures Dependabot PRs don't break version consistency.
|
|
38
|
+
|
|
39
|
+
3. **CLI (developer workflow):** `vg check`, `vg fix`, `vg sync`, `vg tag`, `vg doctor` — manual commands that developers and agents use during the release flow.
|
|
40
|
+
|
|
41
|
+
## Who needs it
|
|
42
|
+
|
|
43
|
+
- **Any project that ships versioned software** and wants to stop version-related drift: stale install commands in docs, missing changelog entries, hardcoded version strings in CI configs or Dockerfiles, tag/manifest mismatches
|
|
44
|
+
- **Teams using AI agents** that modify code — VG is the guardrail that catches when agents skip versioning steps
|
|
45
|
+
- **Polyglot projects** that need consistent version governance across npm, Rust, Python, Dart, PHP, Java, and more
|
|
28
46
|
|
|
29
47
|
## Install
|
|
30
48
|
|
|
31
49
|
```bash
|
|
32
|
-
npm install -D @codluv/versionguard
|
|
33
|
-
|
|
34
|
-
|
|
50
|
+
npm install -D @codluv/versionguard@latest
|
|
51
|
+
vg init
|
|
52
|
+
vg hooks install
|
|
35
53
|
```
|
|
36
54
|
|
|
55
|
+
> `vg` is a shorthand alias for `versionguard`. Both work identically.
|
|
56
|
+
|
|
37
57
|
That gives you:
|
|
38
58
|
|
|
39
59
|
- a `.versionguard.yml` config file
|
|
40
60
|
- managed git hooks
|
|
41
|
-
- a repo-local version policy built around
|
|
61
|
+
- a repo-local version policy built around your manifest
|
|
42
62
|
|
|
43
63
|
## Quick start
|
|
44
64
|
|
|
45
65
|
Run a basic version check:
|
|
46
66
|
|
|
47
67
|
```bash
|
|
48
|
-
|
|
68
|
+
vg check
|
|
49
69
|
```
|
|
50
70
|
|
|
51
|
-
Run full repository validation:
|
|
71
|
+
Run full repository validation (includes scan, guard, and publish checks by default):
|
|
52
72
|
|
|
53
73
|
```bash
|
|
54
|
-
|
|
74
|
+
vg validate
|
|
55
75
|
```
|
|
56
76
|
|
|
57
77
|
For CI or agent workflows:
|
|
58
78
|
|
|
59
79
|
```bash
|
|
60
|
-
|
|
80
|
+
vg validate --json
|
|
61
81
|
```
|
|
62
82
|
|
|
63
|
-
Sync configured files back to the
|
|
83
|
+
Sync configured files back to the manifest version:
|
|
64
84
|
|
|
65
85
|
```bash
|
|
66
|
-
|
|
86
|
+
vg sync
|
|
67
87
|
```
|
|
68
88
|
|
|
69
89
|
Repair common issues automatically:
|
|
70
90
|
|
|
71
91
|
```bash
|
|
72
|
-
|
|
92
|
+
vg fix
|
|
73
93
|
```
|
|
74
94
|
|
|
75
95
|
## Example output
|
|
@@ -100,18 +120,20 @@ How to fix:
|
|
|
100
120
|
|
|
101
121
|
## Configuration
|
|
102
122
|
|
|
103
|
-
VersionGuard uses a single YAML config file.
|
|
123
|
+
VersionGuard uses a single YAML config file. Both `semver:` and `calver:` blocks are always present — change `type` to switch.
|
|
104
124
|
|
|
105
125
|
Example:
|
|
106
126
|
|
|
107
127
|
```yaml
|
|
108
128
|
versioning:
|
|
109
129
|
type: semver
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
130
|
+
semver:
|
|
131
|
+
allowVPrefix: false
|
|
132
|
+
allowBuildMetadata: true
|
|
133
|
+
requirePrerelease: false
|
|
134
|
+
calver:
|
|
135
|
+
format: "YYYY.MM.PATCH"
|
|
136
|
+
preventFutureDates: true
|
|
115
137
|
|
|
116
138
|
sync:
|
|
117
139
|
files:
|
|
@@ -128,6 +150,26 @@ changelog:
|
|
|
128
150
|
file: "CHANGELOG.md"
|
|
129
151
|
strict: true
|
|
130
152
|
requireEntry: true
|
|
153
|
+
enforceStructure: false
|
|
154
|
+
sections:
|
|
155
|
+
- Added
|
|
156
|
+
- Changed
|
|
157
|
+
- Deprecated
|
|
158
|
+
- Removed
|
|
159
|
+
- Fixed
|
|
160
|
+
- Security
|
|
161
|
+
|
|
162
|
+
# All checks below are enabled by default — opt OUT via config
|
|
163
|
+
guard:
|
|
164
|
+
enabled: true # hook bypass detection
|
|
165
|
+
|
|
166
|
+
publish:
|
|
167
|
+
enabled: true # registry publish status verification
|
|
168
|
+
timeout: 5000 # ms, fail-open on timeout
|
|
169
|
+
|
|
170
|
+
scan:
|
|
171
|
+
enabled: true # repo-wide stale version detection
|
|
172
|
+
allowlist: []
|
|
131
173
|
|
|
132
174
|
git:
|
|
133
175
|
hooks:
|
|
@@ -147,39 +189,55 @@ ignore:
|
|
|
147
189
|
|
|
148
190
|
### SemVer
|
|
149
191
|
|
|
150
|
-
VersionGuard supports strict semantic version validation with:
|
|
192
|
+
VersionGuard supports strict semantic version validation with configurable rules via the `semver:` block:
|
|
151
193
|
|
|
152
|
-
- `MAJOR.MINOR.PATCH`
|
|
153
|
-
-
|
|
154
|
-
-
|
|
194
|
+
- `MAJOR.MINOR.PATCH` with prerelease (`1.2.3-alpha.1`) and build metadata (`1.2.3+build.5`)
|
|
195
|
+
- `allowVPrefix` — tolerate `v1.2.3` format (stripped before parsing)
|
|
196
|
+
- `allowBuildMetadata` — permit or reject `+build` metadata suffix
|
|
197
|
+
- `requirePrerelease` — require prerelease labels on every version
|
|
198
|
+
- `schemeRules.allowedModifiers` — whitelist prerelease tags (e.g., `alpha`, `beta`, `rc`)
|
|
155
199
|
- precedence comparison and increment helpers
|
|
156
200
|
|
|
157
201
|
### CalVer
|
|
158
202
|
|
|
159
|
-
|
|
203
|
+
Composable token-based format strings supporting all calver.org tokens:
|
|
204
|
+
|
|
205
|
+
- Year: `YYYY`, `YY`, `0Y`
|
|
206
|
+
- Month: `MM`, `M`, `0M`
|
|
207
|
+
- Week: `WW`, `0W`
|
|
208
|
+
- Day: `DD`, `D`, `0D`
|
|
209
|
+
- Counter: `MICRO`, `PATCH`
|
|
160
210
|
|
|
161
|
-
-
|
|
162
|
-
- `YYYY.MM.PATCH`
|
|
163
|
-
- `YY.M.PATCH`
|
|
164
|
-
- `YYYY.0M.0D`
|
|
211
|
+
CalVer validation can reject future-dated versions and enforce modifier allowlists.
|
|
165
212
|
|
|
166
|
-
|
|
213
|
+
### Language-agnostic manifests
|
|
214
|
+
|
|
215
|
+
VersionGuard reads versions from any supported manifest:
|
|
216
|
+
|
|
217
|
+
- `package.json` (Node.js), `Cargo.toml` (Rust), `pyproject.toml` (Python)
|
|
218
|
+
- `pubspec.yaml` (Dart/Flutter), `composer.json` (PHP), `pom.xml` (Java/Maven)
|
|
219
|
+
- `VERSION` (plain text), Git tags (Go/Swift), Custom regex patterns
|
|
220
|
+
|
|
221
|
+
Set `manifest.source: auto` for automatic detection.
|
|
167
222
|
|
|
168
223
|
## Commands
|
|
169
224
|
|
|
170
225
|
| Command | Description |
|
|
171
226
|
| --- | --- |
|
|
172
|
-
| `
|
|
173
|
-
| `
|
|
174
|
-
| `
|
|
175
|
-
| `
|
|
176
|
-
| `
|
|
177
|
-
| `
|
|
178
|
-
| `
|
|
179
|
-
| `
|
|
180
|
-
| `
|
|
181
|
-
| `
|
|
182
|
-
| `
|
|
227
|
+
| `vg init` | Create `.versionguard.yml` (interactive wizard or headless) |
|
|
228
|
+
| `vg check` | Validate the current version with actionable feedback |
|
|
229
|
+
| `vg validate` | Run all checks: version, sync, changelog, scan, guard, publish |
|
|
230
|
+
| `vg doctor` | Report repository readiness in one pass |
|
|
231
|
+
| `vg fix` | Apply deterministic fixes for common drift |
|
|
232
|
+
| `vg fix-changelog` | Fix Changesets-mangled changelogs to Keep a Changelog format |
|
|
233
|
+
| `vg sync` | Update configured files to match manifest version |
|
|
234
|
+
| `vg bump` | Suggest the next version and optionally apply it |
|
|
235
|
+
| `vg tag [version]` | Create an annotated release tag safely |
|
|
236
|
+
| `vg hooks install` | Install managed git hooks |
|
|
237
|
+
| `vg hooks uninstall` | Remove managed git hooks |
|
|
238
|
+
| `vg hooks status` | Check whether hooks are installed |
|
|
239
|
+
| `vg ckm [topic]` | Codebase Knowledge Manifest — auto-generated help |
|
|
240
|
+
| `vg ckm [topic] --json` | Machine-readable CKM for LLM agents |
|
|
183
241
|
|
|
184
242
|
## Git hook behavior
|
|
185
243
|
|
|
@@ -196,13 +254,13 @@ When `git.enforceHooks` is enabled, release tagging also expects managed hooks t
|
|
|
196
254
|
Use `doctor` when you want a one-pass readiness report before releasing:
|
|
197
255
|
|
|
198
256
|
```bash
|
|
199
|
-
|
|
257
|
+
vg doctor
|
|
200
258
|
```
|
|
201
259
|
|
|
202
260
|
For CI or agent workflows:
|
|
203
261
|
|
|
204
262
|
```bash
|
|
205
|
-
|
|
263
|
+
vg doctor --json
|
|
206
264
|
```
|
|
207
265
|
|
|
208
266
|
It reports:
|
|
@@ -219,7 +277,7 @@ It reports:
|
|
|
219
277
|
Use `validate --json` when you need machine-readable validation output:
|
|
220
278
|
|
|
221
279
|
```bash
|
|
222
|
-
|
|
280
|
+
vg validate --json
|
|
223
281
|
```
|
|
224
282
|
|
|
225
283
|
The JSON payload includes:
|
|
@@ -229,6 +287,11 @@ The JSON payload includes:
|
|
|
229
287
|
- `versionValid`
|
|
230
288
|
- `syncValid`
|
|
231
289
|
- `changelogValid`
|
|
290
|
+
- `scanValid`
|
|
291
|
+
- `guardValid`
|
|
292
|
+
- `publishValid`
|
|
293
|
+
- `publishCheck`
|
|
294
|
+
- `guardReport`
|
|
232
295
|
- `errors`
|
|
233
296
|
- `hook`
|
|
234
297
|
- `postTag`
|
|
@@ -247,31 +310,46 @@ It can refuse to proceed when:
|
|
|
247
310
|
|
|
248
311
|
That keeps release tags from becoming a bypass around normal validation.
|
|
249
312
|
|
|
313
|
+
## Stability Policy
|
|
314
|
+
|
|
315
|
+
1.x maintains backward compatibility for all CLI commands and configuration formats. Breaking changes only occur in 2.0+.
|
|
316
|
+
|
|
317
|
+
Deprecated flags (`--strict`, `--scan`) continue to work in 1.x and print a warning. Their behavior is now the default. To opt out of specific checks, use config:
|
|
318
|
+
|
|
319
|
+
```yaml
|
|
320
|
+
guard:
|
|
321
|
+
enabled: false
|
|
322
|
+
scan:
|
|
323
|
+
enabled: false
|
|
324
|
+
publish:
|
|
325
|
+
enabled: false
|
|
326
|
+
```
|
|
327
|
+
|
|
250
328
|
## Typical workflows
|
|
251
329
|
|
|
252
330
|
### Validate before committing
|
|
253
331
|
|
|
254
332
|
```bash
|
|
255
|
-
|
|
333
|
+
vg validate
|
|
256
334
|
```
|
|
257
335
|
|
|
258
336
|
### Repair drift after a manual version change
|
|
259
337
|
|
|
260
338
|
```bash
|
|
261
339
|
npm version patch
|
|
262
|
-
|
|
340
|
+
vg fix
|
|
263
341
|
```
|
|
264
342
|
|
|
265
343
|
### Suggest and apply the next version
|
|
266
344
|
|
|
267
345
|
```bash
|
|
268
|
-
|
|
346
|
+
vg bump --apply
|
|
269
347
|
```
|
|
270
348
|
|
|
271
349
|
### Create a release tag safely
|
|
272
350
|
|
|
273
351
|
```bash
|
|
274
|
-
|
|
352
|
+
vg tag 1.2.3 -m "Release 1.2.3"
|
|
275
353
|
```
|
|
276
354
|
|
|
277
355
|
## Using with Changesets
|
|
@@ -281,10 +359,12 @@ VersionGuard and [Changesets](https://github.com/changesets/changesets) are comp
|
|
|
281
359
|
| Concern | Changesets | VersionGuard |
|
|
282
360
|
| --- | --- | --- |
|
|
283
361
|
| Decide the next version | Yes | No (validates, doesn't choose) |
|
|
284
|
-
| Update
|
|
362
|
+
| Update manifest version | Yes | No (reads it as source of truth) |
|
|
285
363
|
| Validate version format | No | Yes (SemVer/CalVer strictness) |
|
|
286
364
|
| Sync version across files | No | Yes (regex-based sync) |
|
|
287
|
-
| Validate changelog structure | No | Yes (Keep a Changelog) |
|
|
365
|
+
| Validate changelog structure | No | Yes (Keep a Changelog + section enforcement) |
|
|
366
|
+
| Scan repo for stale versions | No | Yes |
|
|
367
|
+
| Verify publish status on registry | No | Yes (fail-open) |
|
|
288
368
|
| Git hooks enforcement | No | Yes |
|
|
289
369
|
| Publish to npm | Yes | No |
|
|
290
370
|
|
|
@@ -300,7 +380,7 @@ npx changeset
|
|
|
300
380
|
npx changeset version
|
|
301
381
|
|
|
302
382
|
# 3. VersionGuard validates the new state
|
|
303
|
-
|
|
383
|
+
vg validate
|
|
304
384
|
|
|
305
385
|
# 4. Publish
|
|
306
386
|
npx changeset publish
|
|
@@ -312,7 +392,7 @@ In GitHub Actions, both tools run in sequence. Changesets creates a "Version Pac
|
|
|
312
392
|
|
|
313
393
|
```yaml
|
|
314
394
|
- run: npm run build
|
|
315
|
-
- run:
|
|
395
|
+
- run: vg validate
|
|
316
396
|
- uses: changesets/action@v1
|
|
317
397
|
with:
|
|
318
398
|
publish: npx changeset publish --access public
|
|
@@ -368,6 +448,7 @@ npx vitest run src/__tests__/calver.test.ts -t "increments patch-based versions"
|
|
|
368
448
|
|
|
369
449
|
- Product vision: `docs/VISION.md`
|
|
370
450
|
- Verified feature ledger and roadmap: `docs/FEATURES.md`
|
|
451
|
+
- CKM module documentation: `src/ckm/README-CKM.md`
|
|
371
452
|
- Agent guidance for contributors: `AGENTS.md`
|
|
372
453
|
|
|
373
454
|
## Forge
|