@wipcomputer/wip-license-guard 1.9.31 → 1.9.34
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 +53 -16
- package/cli.mjs +9 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -2,31 +2,68 @@
|
|
|
2
2
|
|
|
3
3
|
# License Guard
|
|
4
4
|
|
|
5
|
-
Enforce licensing on every
|
|
5
|
+
Enforce licensing on every repo. Copyright, dual-license, CLA, README license section. Checked automatically on every release.
|
|
6
6
|
|
|
7
|
-
##
|
|
7
|
+
## Commands
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
-
|
|
11
|
-
-
|
|
12
|
-
-
|
|
13
|
-
-
|
|
14
|
-
-
|
|
9
|
+
```bash
|
|
10
|
+
wip-license-guard check # audit current repo
|
|
11
|
+
wip-license-guard check --fix # audit and auto-fix issues
|
|
12
|
+
wip-license-guard init # interactive first-run setup
|
|
13
|
+
wip-license-guard init --from-standard # apply WIP Computer defaults without prompting
|
|
14
|
+
wip-license-guard readme-license # audit license blocks across all repos
|
|
15
|
+
wip-license-guard readme-license --fix # apply standard license block to all READMEs
|
|
16
|
+
wip-license-guard readme-license --dry-run # preview changes without writing
|
|
17
|
+
```
|
|
15
18
|
|
|
16
|
-
##
|
|
19
|
+
## What it checks
|
|
17
20
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
+
- LICENSE file exists and matches configured license type
|
|
22
|
+
- Copyright line is correct and current year
|
|
23
|
+
- CLA.md exists (if configured)
|
|
24
|
+
- README has a `## License` section with the standard block
|
|
25
|
+
- For toolbox repos: checks every sub-tool in `tools/`
|
|
26
|
+
|
|
27
|
+
## Config
|
|
28
|
+
|
|
29
|
+
`.license-guard.json` in repo root. Created by `init`. Contains copyright holder, license type, year, and what to enforce.
|
|
30
|
+
|
|
31
|
+
```json
|
|
32
|
+
{
|
|
33
|
+
"copyright": "WIP Computer, Inc.",
|
|
34
|
+
"license": "MIT+AGPL",
|
|
35
|
+
"year": 2026,
|
|
36
|
+
"enforceCLA": true,
|
|
37
|
+
"enforceReadmeLicense": true
|
|
38
|
+
}
|
|
21
39
|
```
|
|
22
40
|
|
|
23
|
-
##
|
|
41
|
+
## wip-release gate
|
|
42
|
+
|
|
43
|
+
Step 0 of wip-release reads `.license-guard.json` and runs the same checks. If compliance fails, the release is blocked.
|
|
24
44
|
|
|
25
|
-
-
|
|
26
|
-
|
|
45
|
+
## `--from-standard` generates
|
|
46
|
+
|
|
47
|
+
- `.license-guard.json` with WIP Computer defaults
|
|
48
|
+
- `LICENSE` file (dual MIT+AGPL)
|
|
49
|
+
- `CLA.md`
|
|
50
|
+
|
|
51
|
+
## readme-license
|
|
52
|
+
|
|
53
|
+
Scans all repos in a directory and applies a standard license block to every README. Removes duplicate license sections from sub-tool READMEs. Reads templates from `ai/wip-templates/readme/`.
|
|
54
|
+
|
|
55
|
+
## Source
|
|
56
|
+
|
|
57
|
+
Pure JavaScript, no build step. Zero dependencies.
|
|
58
|
+
|
|
59
|
+
- `cli.mjs` ... CLI entry point
|
|
60
|
+
- `core.mjs` ... license checking and generation logic
|
|
61
|
+
- `hook.mjs` ... wip-release gate integration
|
|
27
62
|
|
|
28
63
|
## Interfaces
|
|
29
64
|
|
|
30
|
-
- **CLI**:
|
|
65
|
+
- **CLI**: `wip-license-guard`
|
|
31
66
|
|
|
32
67
|
## Part of [AI DevOps Toolbox](https://github.com/wipcomputer/wip-ai-devops-toolbox)
|
|
68
|
+
|
|
69
|
+
Built by Parker Todd Brooks, Lēsa (OpenClaw, Claude Opus 4.6), Claude Code (Claude Opus 4.6).
|
package/cli.mjs
CHANGED
|
@@ -4,10 +4,18 @@
|
|
|
4
4
|
// Ensures correct copyright, dual-license blocks, and LICENSE files.
|
|
5
5
|
|
|
6
6
|
import { existsSync, readFileSync, writeFileSync, readdirSync } from 'node:fs';
|
|
7
|
-
import { join } from 'node:path';
|
|
7
|
+
import { join, dirname } from 'node:path';
|
|
8
|
+
import { fileURLToPath } from 'node:url';
|
|
8
9
|
import { createInterface } from 'node:readline';
|
|
9
10
|
import { generateLicense, generateCLA, generateReadmeBlock, replaceReadmeLicenseSection, removeReadmeLicenseSection } from './core.mjs';
|
|
10
11
|
|
|
12
|
+
if (process.argv.includes('--version') || process.argv.includes('-v')) {
|
|
13
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
14
|
+
const pkg = JSON.parse(readFileSync(join(__dirname, 'package.json'), 'utf8'));
|
|
15
|
+
console.log(pkg.version);
|
|
16
|
+
process.exit(0);
|
|
17
|
+
}
|
|
18
|
+
|
|
11
19
|
const args = process.argv.slice(2);
|
|
12
20
|
const HELP_FLAGS = ['--help', '-h', 'help'];
|
|
13
21
|
const command = HELP_FLAGS.some(f => args.includes(f)) ? 'help' : (args.find(a => !a.startsWith('--')) || 'check');
|
package/package.json
CHANGED