rcf-protocol 1.2.1 → 1.2.3

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 CHANGED
@@ -21,6 +21,8 @@ npm install -D rcf-protocol
21
21
  - **Standardized Markers Check**: Identify `[RCF:PUBLIC]`, `[RCF:PROTECTED]`, `[RCF:RESTRICTED]`, and `[RCF:NOTICE]` markers in your codebase.
22
22
  - **Header Validation**: Ensure files have the required `NOTICE: This file is protected under RCF-PL v1.1` header.
23
23
  - **Automated Scanning**: Quickly scan projects for compliance.
24
+ - **RCF-Audit (Premium)**: Generate cryptographically signed compliance reports for enterprise auditing.
25
+
24
26
 
25
27
  ## CLI Usage
26
28
 
@@ -32,6 +34,9 @@ rcf-cli .
32
34
 
33
35
  # Scan with custom ignore list (in addition to .rcfignore)
34
36
  rcf-cli . --ignore node_modules,dist,.git
37
+
38
+ # Generate an RCF-Audit Report (Requires License)
39
+ rcf-cli audit . --license-key YOUR_RCF_AUDIT_KEY
35
40
  ```
36
41
 
37
42
  ## Markers Reference
@@ -2,6 +2,10 @@ import { ParseResult, ValidationError } from './types';
2
2
  interface ValidatorOptions {
3
3
  strict?: boolean;
4
4
  }
5
+ /**
6
+ * [RCF:RESTRICTED]
7
+ * The ComplianceValidator class enforces strict adherence to RCF specification standards.
8
+ */
5
9
  export declare class ComplianceValidator {
6
10
  private strict;
7
11
  constructor(options?: ValidatorOptions);
@@ -1,6 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ComplianceValidator = void 0;
4
+ /**
5
+ * [RCF:RESTRICTED]
6
+ * The ComplianceValidator class enforces strict adherence to RCF specification standards.
7
+ */
4
8
  class ComplianceValidator {
5
9
  constructor(options = {}) {
6
10
  this.strict = options.strict || false;
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.MARKER_REGEX = exports.RCF_MARKERS = void 0;
4
+ // [RCF:PUBLIC]
4
5
  exports.RCF_MARKERS = {
5
6
  PUBLIC: {
6
7
  name: '[RCF:PUBLIC]',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rcf-protocol",
3
- "version": "1.2.1",
3
+ "version": "1.2.3",
4
4
  "description": "RCF Protocol SDK for TypeScript/JavaScript",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -1,2 +0,0 @@
1
- #!/usr/bin/env node
2
- export {};
package/dist/cli/index.js DELETED
@@ -1,121 +0,0 @@
1
- #!/usr/bin/env node
2
- "use strict";
3
- var __importDefault = (this && this.__importDefault) || function (mod) {
4
- return (mod && mod.__esModule) ? mod : { "default": mod };
5
- };
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
- const commander_1 = require("commander");
8
- const chalk_1 = __importDefault(require("chalk"));
9
- const MarkerParser_1 = require("../core/MarkerParser");
10
- const ComplianceValidator_1 = require("../core/ComplianceValidator");
11
- const fs_1 = require("fs");
12
- const path_1 = require("path");
13
- const crypto_1 = require("crypto");
14
- const pkg = JSON.parse((0, fs_1.readFileSync)((0, path_1.resolve)(__dirname, '../../package.json'), 'utf-8'));
15
- const program = new commander_1.Command();
16
- program
17
- .name('rcf-cli')
18
- .description('RCF Protocol CLI')
19
- .version(pkg.version);
20
- program
21
- .command('scan [directory]')
22
- .description('Scan directory for RCF markers')
23
- .option('-f, --format <type>', 'output format', 'pretty')
24
- .option('--summary', 'show summary only')
25
- .action(async (directory = '.', options) => {
26
- const parser = new MarkerParser_1.MarkerParser();
27
- const results = await parser.scan(directory);
28
- if (options.summary) {
29
- printSummary(results);
30
- }
31
- else {
32
- printResults(results, options.format);
33
- }
34
- });
35
- program
36
- .command('validate [directory]')
37
- .description('Validate RCF compliance')
38
- .option('--strict', 'strict mode')
39
- .action(async (directory = '.', options) => {
40
- const parser = new MarkerParser_1.MarkerParser();
41
- const results = await parser.scan(directory);
42
- const validator = new ComplianceValidator_1.ComplianceValidator({ strict: options.strict });
43
- const status = await validator.validate(results);
44
- if (status.valid) {
45
- console.log(chalk_1.default.green('✅ RCF compliance validated'));
46
- }
47
- else {
48
- console.log(chalk_1.default.red('❌ RCF compliance failed'));
49
- status.errors.forEach(e => console.log(chalk_1.default.red(` • ${e.file}:${e.line} - ${e.message}`)));
50
- process.exit(1);
51
- }
52
- });
53
- program
54
- .command('audit [directory]')
55
- .description('Generate an RCF Audit Report (Premium Feature)')
56
- .option('-k, --license-key <key>', 'RCF Audit License Key')
57
- .action(async (directory = '.', options) => {
58
- const licenseKey = options.licenseKey || process.env.RCF_LICENSE_KEY;
59
- const uuidRegex = /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-4[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$/;
60
- if (!licenseKey || !licenseKey.startsWith('RCF-AUDIT-') || !uuidRegex.test(licenseKey.replace('RCF-AUDIT-', ''))) {
61
- console.log(chalk_1.default.red("❌ RCF-PL ERROR: The 'audit' command is a premium feature."));
62
- console.log(chalk_1.default.yellow(" Please provide a valid RCF-AUDIT license key via -k/--license-key or RCF_LICENSE_KEY env variable."));
63
- console.log(chalk_1.default.blue(" Visit https://rcf.aliyev.site to obtain a license."));
64
- process.exit(1);
65
- }
66
- const parser = new MarkerParser_1.MarkerParser();
67
- const results = await parser.scan(directory);
68
- const auditReport = {
69
- timestamp: new Date().toISOString(),
70
- audit_type: "RCF-Audit as a Service",
71
- protected_assets: []
72
- };
73
- for (const res of results) {
74
- if (res.markers && res.markers.length > 0) {
75
- try {
76
- const fileBuffer = (0, fs_1.readFileSync)(res.file);
77
- const fileHash = (0, crypto_1.createHash)('sha256').update(fileBuffer).digest('hex');
78
- const uniqueMarkers = Array.from(new Set(res.markers.map((m) => m.type)));
79
- const relPath = (0, path_1.relative)((0, path_1.resolve)(directory), res.file);
80
- auditReport.protected_assets.push({
81
- file: relPath,
82
- markers: uniqueMarkers,
83
- sha256: fileHash
84
- });
85
- }
86
- catch (e) {
87
- // ignore
88
- }
89
- }
90
- }
91
- const reportPath = (0, path_1.resolve)(directory, 'RCF-AUDIT-REPORT.json');
92
- (0, fs_1.writeFileSync)(reportPath, JSON.stringify(auditReport, null, 2));
93
- console.log(chalk_1.default.green(`✅ RCF-Audit Complete. Generated ${reportPath}`));
94
- console.log(chalk_1.default.cyan(`🔒 Encrypted snapshot of ${auditReport.protected_assets.length} protected assets created.`));
95
- });
96
- function printSummary(results) {
97
- const stats = { PUBLIC: 0, PROTECTED: 0, RESTRICTED: 0, NOTICE: 0 };
98
- results.forEach(r => r.markers.forEach((m) => stats[m.type]++));
99
- console.log(chalk_1.default.bold('\n📊 RCF Markers Summary:'));
100
- console.log(` ${chalk_1.default.green('[RCF:PUBLIC]')}: ${stats.PUBLIC}`);
101
- console.log(` ${chalk_1.default.yellow('[RCF:PROTECTED]')}: ${stats.PROTECTED}`);
102
- console.log(` ${chalk_1.default.red('[RCF:RESTRICTED]')}: ${stats.RESTRICTED}`);
103
- console.log(` ${chalk_1.default.blue('[RCF:NOTICE]')}: ${stats.NOTICE}`);
104
- console.log(` Total files: ${results.length}\n`);
105
- }
106
- function printResults(results, format) {
107
- if (format === 'json') {
108
- console.log(JSON.stringify(results, null, 2));
109
- return;
110
- }
111
- results.forEach(({ file, markers }) => {
112
- console.log(chalk_1.default.bold(`\n📄 ${file}`));
113
- markers.forEach((m) => {
114
- const color = m.type === 'PUBLIC' ? 'green' :
115
- m.type === 'PROTECTED' ? 'yellow' :
116
- m.type === 'RESTRICTED' ? 'red' : 'blue';
117
- console.log(` ${chalk_1.default[color](m.marker.name)} Line ${m.line}: ${m.context.substring(0, 50)}...`);
118
- });
119
- });
120
- }
121
- program.parse();