cgd-verify 0.1.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.
Files changed (4) hide show
  1. package/README.md +63 -0
  2. package/bin/cli.js +76 -0
  3. package/index.js +16 -0
  4. package/package.json +39 -0
package/README.md ADDED
@@ -0,0 +1,63 @@
1
+ # cgd-verify
2
+
3
+ Quick pass/fail verification for Clarity-Gated Document (`.cgd`) files — optimized for CI/CD pipelines.
4
+
5
+ [![npm version](https://badge.fury.io/js/cgd-verify.svg)](https://www.npmjs.com/package/cgd-verify)
6
+ [![License: CC BY 4.0](https://img.shields.io/badge/License-CC_BY_4.0-lightgrey.svg)](https://creativecommons.org/licenses/by/4.0/)
7
+
8
+ ## When to Use
9
+
10
+ | Tool | Use Case |
11
+ |------|----------|
12
+ | **cgd-verify** | CI/CD pipelines, git hooks, quick checks |
13
+ | **cgd-validator** | Detailed reports, debugging, development |
14
+
15
+ ## Installation
16
+
17
+ ```bash
18
+ npm install -g cgd-verify
19
+ ```
20
+
21
+ ## CLI Usage
22
+
23
+ ```bash
24
+ # Quick check - exit 0 if valid, exit 1 if invalid
25
+ cgd-verify document.cgd
26
+
27
+ # Multiple files
28
+ cgd-verify docs/*.cgd
29
+
30
+ # Silent mode (only exit code, no output)
31
+ cgd-verify document.cgd --silent
32
+ ```
33
+
34
+ ## In CI/CD
35
+
36
+ ```yaml
37
+ # GitHub Actions
38
+ - run: npx cgd-verify docs/*.cgd
39
+
40
+ # Pre-commit hook
41
+ cgd-verify $(git diff --cached --name-only -- '*.cgd')
42
+ ```
43
+
44
+ ## API
45
+
46
+ ```javascript
47
+ // Re-exports everything from cgd-validator
48
+ const { validate, isValid, detect } = require('cgd-verify');
49
+
50
+ if (isValid(content)) {
51
+ console.log('Valid');
52
+ }
53
+ ```
54
+
55
+ ## Related
56
+
57
+ - [cgd-validator](https://www.npmjs.com/package/cgd-validator) - Detailed validation with warnings
58
+ - [sot-verify](https://www.npmjs.com/package/sot-verify) - Quick verification for .sot files
59
+ - [Clarity Gate](https://github.com/frmoretto/clarity-gate) - Full ecosystem
60
+
61
+ ## License
62
+
63
+ CC BY 4.0
package/bin/cli.js ADDED
@@ -0,0 +1,76 @@
1
+ #!/usr/bin/env node
2
+
3
+ /**
4
+ * cgd-verify CLI
5
+ * Quick pass/fail verification for CI/CD pipelines
6
+ *
7
+ * For detailed output with warnings, use cgd-validator instead.
8
+ */
9
+
10
+ const fs = require('fs');
11
+ const path = require('path');
12
+ const { validate, VERSION } = require('cgd-validator');
13
+
14
+ const args = process.argv.slice(2);
15
+
16
+ if (args.includes('--version') || args.includes('-v')) {
17
+ console.log(`cgd-verify v${VERSION}`);
18
+ process.exit(0);
19
+ }
20
+
21
+ if (args.includes('--help') || args.includes('-h') || args.length === 0) {
22
+ console.log(`
23
+ cgd-verify v${VERSION}
24
+ Quick pass/fail verification for Clarity-Gated Document (.cgd) files
25
+
26
+ Usage:
27
+ cgd-verify <file.cgd> [file2.cgd ...]
28
+
29
+ Options:
30
+ -h, --help Show this help message
31
+ -v, --version Show version number
32
+ -s, --silent No output, only exit code
33
+
34
+ Exit codes:
35
+ 0 = All files valid
36
+ 1 = One or more files invalid
37
+
38
+ For detailed validation with warnings, use: cgd-validator
39
+
40
+ Part of the Clarity Gate ecosystem:
41
+ https://github.com/frmoretto/clarity-gate
42
+ `);
43
+ process.exit(0);
44
+ }
45
+
46
+ const silent = args.includes('-s') || args.includes('--silent');
47
+ const files = args.filter(a => !a.startsWith('-'));
48
+
49
+ if (files.length === 0) {
50
+ console.error('Error: No files specified');
51
+ process.exit(1);
52
+ }
53
+
54
+ let allValid = true;
55
+
56
+ for (const file of files) {
57
+ const filePath = path.resolve(file);
58
+
59
+ if (!fs.existsSync(filePath)) {
60
+ if (!silent) console.log(`✗ ${file}: NOT FOUND`);
61
+ allValid = false;
62
+ continue;
63
+ }
64
+
65
+ const content = fs.readFileSync(filePath, 'utf8');
66
+ const result = validate(content);
67
+
68
+ if (result.valid) {
69
+ if (!silent) console.log(`✓ ${file}`);
70
+ } else {
71
+ if (!silent) console.log(`✗ ${file}`);
72
+ allValid = false;
73
+ }
74
+ }
75
+
76
+ process.exit(allValid ? 0 : 1);
package/index.js ADDED
@@ -0,0 +1,16 @@
1
+ /**
2
+ * cgd-verify
3
+ *
4
+ * Quick verification for Clarity-Gated Document (.cgd) files
5
+ * Lightweight wrapper around cgd-validator for CI/CD pipelines
6
+ *
7
+ * For detailed validation with warnings, use cgd-validator instead.
8
+ *
9
+ * @see https://github.com/frmoretto/clarity-gate
10
+ * @license CC-BY-4.0
11
+ */
12
+
13
+ // Re-export from cgd-validator
14
+ const cgdValidator = require('cgd-validator');
15
+
16
+ module.exports = cgdValidator;
package/package.json ADDED
@@ -0,0 +1,39 @@
1
+ {
2
+ "name": "cgd-verify",
3
+ "version": "0.1.0",
4
+ "description": "Quick verification for Clarity-Gated Document (.cgd) files - returns pass/fail for CI/CD pipelines",
5
+ "main": "index.js",
6
+ "bin": {
7
+ "cgd-verify": "./bin/cli.js"
8
+ },
9
+ "scripts": {
10
+ "test": "echo \"Tests coming soon\" && exit 0"
11
+ },
12
+ "keywords": [
13
+ "cgd",
14
+ "clarity-gate",
15
+ "verify",
16
+ "validator",
17
+ "epistemic",
18
+ "ai-safety",
19
+ "rag",
20
+ "ci-cd",
21
+ "llm"
22
+ ],
23
+ "author": "Francesco Marinoni Moretto",
24
+ "license": "CC-BY-4.0",
25
+ "repository": {
26
+ "type": "git",
27
+ "url": "https://github.com/frmoretto/clarity-gate"
28
+ },
29
+ "homepage": "https://github.com/frmoretto/clarity-gate",
30
+ "bugs": {
31
+ "url": "https://github.com/frmoretto/clarity-gate/issues"
32
+ },
33
+ "engines": {
34
+ "node": ">=16.0.0"
35
+ },
36
+ "dependencies": {
37
+ "cgd-validator": "^0.1.0"
38
+ }
39
+ }