sot-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.
- package/README.md +63 -0
- package/bin/cli.js +76 -0
- package/index.js +16 -0
- package/package.json +39 -0
package/README.md
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
# sot-verify
|
|
2
|
+
|
|
3
|
+
Quick pass/fail verification for Source of Truth (`.sot`) files — optimized for CI/CD pipelines.
|
|
4
|
+
|
|
5
|
+
[](https://www.npmjs.com/package/sot-verify)
|
|
6
|
+
[](https://creativecommons.org/licenses/by/4.0/)
|
|
7
|
+
|
|
8
|
+
## When to Use
|
|
9
|
+
|
|
10
|
+
| Tool | Use Case |
|
|
11
|
+
|------|----------|
|
|
12
|
+
| **sot-verify** | CI/CD pipelines, git hooks, quick checks |
|
|
13
|
+
| **sot-validator** | Detailed reports, debugging, development |
|
|
14
|
+
|
|
15
|
+
## Installation
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
npm install -g sot-verify
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## CLI Usage
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
# Quick check - exit 0 if valid, exit 1 if invalid
|
|
25
|
+
sot-verify project.sot
|
|
26
|
+
|
|
27
|
+
# Multiple files
|
|
28
|
+
sot-verify docs/*.sot
|
|
29
|
+
|
|
30
|
+
# Silent mode (only exit code, no output)
|
|
31
|
+
sot-verify project.sot --silent
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## In CI/CD
|
|
35
|
+
|
|
36
|
+
```yaml
|
|
37
|
+
# GitHub Actions
|
|
38
|
+
- run: npx sot-verify docs/*.sot
|
|
39
|
+
|
|
40
|
+
# Pre-commit hook
|
|
41
|
+
sot-verify $(git diff --cached --name-only -- '*.sot')
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## API
|
|
45
|
+
|
|
46
|
+
```javascript
|
|
47
|
+
// Re-exports everything from sot-validator
|
|
48
|
+
const { validate, isValid, detect } = require('sot-verify');
|
|
49
|
+
|
|
50
|
+
if (isValid(content)) {
|
|
51
|
+
console.log('Valid');
|
|
52
|
+
}
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## Related
|
|
56
|
+
|
|
57
|
+
- [sot-validator](https://www.npmjs.com/package/sot-validator) - Detailed validation with warnings
|
|
58
|
+
- [cgd-verify](https://www.npmjs.com/package/cgd-verify) - Quick verification for .cgd 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
|
+
* sot-verify CLI
|
|
5
|
+
* Quick pass/fail verification for CI/CD pipelines
|
|
6
|
+
*
|
|
7
|
+
* For detailed output with warnings, use sot-validator instead.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
const fs = require('fs');
|
|
11
|
+
const path = require('path');
|
|
12
|
+
const { validate, VERSION } = require('sot-validator');
|
|
13
|
+
|
|
14
|
+
const args = process.argv.slice(2);
|
|
15
|
+
|
|
16
|
+
if (args.includes('--version') || args.includes('-v')) {
|
|
17
|
+
console.log(`sot-verify v${VERSION}`);
|
|
18
|
+
process.exit(0);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
if (args.includes('--help') || args.includes('-h') || args.length === 0) {
|
|
22
|
+
console.log(`
|
|
23
|
+
sot-verify v${VERSION}
|
|
24
|
+
Quick pass/fail verification for Source of Truth (.sot) files
|
|
25
|
+
|
|
26
|
+
Usage:
|
|
27
|
+
sot-verify <file.sot> [file2.sot ...]
|
|
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: sot-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
|
+
* sot-verify
|
|
3
|
+
*
|
|
4
|
+
* Quick verification for Source of Truth (.sot) files
|
|
5
|
+
* Lightweight wrapper around sot-validator for CI/CD pipelines
|
|
6
|
+
*
|
|
7
|
+
* For detailed validation with warnings, use sot-validator instead.
|
|
8
|
+
*
|
|
9
|
+
* @see https://github.com/frmoretto/clarity-gate
|
|
10
|
+
* @license CC-BY-4.0
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
// Re-export from sot-validator
|
|
14
|
+
const sotValidator = require('sot-validator');
|
|
15
|
+
|
|
16
|
+
module.exports = sotValidator;
|
package/package.json
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "sot-verify",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Quick verification for Source of Truth (.sot) files - returns pass/fail for CI/CD pipelines",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"bin": {
|
|
7
|
+
"sot-verify": "./bin/cli.js"
|
|
8
|
+
},
|
|
9
|
+
"scripts": {
|
|
10
|
+
"test": "echo \"Tests coming soon\" && exit 0"
|
|
11
|
+
},
|
|
12
|
+
"keywords": [
|
|
13
|
+
"sot",
|
|
14
|
+
"source-of-truth",
|
|
15
|
+
"verify",
|
|
16
|
+
"validator",
|
|
17
|
+
"epistemic",
|
|
18
|
+
"ai-safety",
|
|
19
|
+
"rag",
|
|
20
|
+
"ci-cd",
|
|
21
|
+
"clarity-gate"
|
|
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
|
+
"sot-validator": "^0.1.0"
|
|
38
|
+
}
|
|
39
|
+
}
|