agent-cfml-check 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.
@@ -0,0 +1,93 @@
1
+ export declare const TOOL_ID: "agent-cfml-check";
2
+ export declare const TOOL_VERSION: "0.1.0";
3
+ export declare const PROFILE_ID: "cfml-structure-v1";
4
+ export interface Position {
5
+ line: number;
6
+ column: number;
7
+ }
8
+ export interface SourceLocation {
9
+ start: Position;
10
+ end: Position;
11
+ start_byte: number;
12
+ end_byte: number;
13
+ }
14
+ export interface Finding {
15
+ code: "UNEXPECTED_CLOSE" | "MISMATCHED_CLOSE" | "UNCLOSED_TAG" | "INVALID_BRANCH" | "UNTERMINATED_STRING" | "UNTERMINATED_COMMENT" | "UNBALANCED_DELIMITER";
16
+ message: string;
17
+ location: SourceLocation;
18
+ related_open: SourceLocation | null;
19
+ }
20
+ export interface SourceInfo {
21
+ path: string;
22
+ sha256: string;
23
+ byte_size: number;
24
+ encoding: "utf-8";
25
+ bom: boolean;
26
+ }
27
+ export interface CheckData {
28
+ profile: typeof PROFILE_ID;
29
+ source: SourceInfo;
30
+ verdict: "pass" | "violations";
31
+ checks: string[];
32
+ exclusions: string[];
33
+ findings: Finding[];
34
+ }
35
+ export interface EnvelopeError {
36
+ code: string;
37
+ message: string;
38
+ }
39
+ export interface EnvelopeMeta {
40
+ scope: string;
41
+ limits: {
42
+ max_source_bytes: number;
43
+ max_nesting: number;
44
+ max_findings: number;
45
+ max_output_bytes: number;
46
+ time_limit_ms: number;
47
+ };
48
+ }
49
+ export interface Envelope<T> {
50
+ schema_version: "1.0.0";
51
+ tool: {
52
+ id: typeof TOOL_ID;
53
+ version: typeof TOOL_VERSION;
54
+ };
55
+ status: "ok" | "incomplete" | "error";
56
+ complete: boolean;
57
+ data: T | null;
58
+ errors: EnvelopeError[];
59
+ warnings: EnvelopeError[];
60
+ meta: EnvelopeMeta;
61
+ }
62
+ export interface CheckLimits {
63
+ max_source_bytes: number;
64
+ max_nesting: number;
65
+ max_findings: number;
66
+ max_output_bytes: number;
67
+ time_limit_ms: number;
68
+ }
69
+ export interface CheckOptions {
70
+ root: string;
71
+ file: string;
72
+ limits?: Partial<CheckLimits>;
73
+ }
74
+ export interface LoadedSource {
75
+ requested_path: string;
76
+ resolved_path: string;
77
+ relative_path: string;
78
+ source: string;
79
+ bytes: Buffer;
80
+ bom: boolean;
81
+ }
82
+ export interface CapabilitiesData {
83
+ profile: typeof PROFILE_ID;
84
+ operations: string[];
85
+ extensions: string[];
86
+ supported_tags: {
87
+ paired_bodies: string[];
88
+ branches: string[];
89
+ bodyless: string[];
90
+ };
91
+ limits: CheckLimits;
92
+ exclusions: string[];
93
+ }
@@ -0,0 +1,3 @@
1
+ export const TOOL_ID = "agent-cfml-check";
2
+ export const TOOL_VERSION = "0.1.0";
3
+ export const PROFILE_ID = "cfml-structure-v1";
@@ -0,0 +1,4 @@
1
+ <cfif enabled>
2
+ <cfloop array="#items#">
3
+ </cfif>
4
+ </cfloop>
@@ -0,0 +1,3 @@
1
+ <cfif enabled>
2
+ <cfoutput>#message#</cfoutput>
3
+ </cfif>
package/package.json ADDED
@@ -0,0 +1,30 @@
1
+ {
2
+ "name": "agent-cfml-check",
3
+ "version": "0.1.0",
4
+ "description": "Deterministic, read-only structural checks for a bounded CFML subset.",
5
+ "type": "module",
6
+ "license": "MIT",
7
+ "engines": {
8
+ "node": ">=18.18.0"
9
+ },
10
+ "bin": {
11
+ "agent-cfml-check": "dist/cli/index.js"
12
+ },
13
+ "files": [
14
+ "dist",
15
+ "README.md",
16
+ "SPEC.md",
17
+ "schema",
18
+ "fixtures"
19
+ ],
20
+ "scripts": {
21
+ "typecheck": "tsc -p tsconfig.json --noEmit",
22
+ "build": "tsc -p tsconfig.build.json",
23
+ "test": "npm run build && tsc -p tsconfig.test.json && node --test .test-dist/test/check.test.js .test-dist/test/cli.test.js",
24
+ "prepack": "npm run build"
25
+ },
26
+ "devDependencies": {
27
+ "@types/node": "^22.10.0",
28
+ "typescript": "^5.7.0"
29
+ }
30
+ }
@@ -0,0 +1,134 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "urn:agent-cfml-check:result-v1",
4
+ "title": "Agent CFML Check Result",
5
+ "type": "object",
6
+ "required": ["schema_version", "tool", "status", "complete", "data", "errors", "warnings", "meta"],
7
+ "properties": {
8
+ "schema_version": { "const": "1.0.0" },
9
+ "tool": {
10
+ "type": "object",
11
+ "required": ["id", "version"],
12
+ "properties": {
13
+ "id": { "const": "agent-cfml-check" },
14
+ "version": { "type": "string", "pattern": "^[0-9]+\\.[0-9]+\\.[0-9]+$" }
15
+ },
16
+ "additionalProperties": false
17
+ },
18
+ "status": { "enum": ["ok", "incomplete", "error"] },
19
+ "complete": { "type": "boolean" },
20
+ "data": {
21
+ "anyOf": [
22
+ { "$ref": "#/$defs/check_data" },
23
+ { "$ref": "#/$defs/capabilities_data" },
24
+ { "type": "null" }
25
+ ]
26
+ },
27
+ "errors": { "type": "array", "items": { "$ref": "#/$defs/message" } },
28
+ "warnings": { "type": "array", "items": { "$ref": "#/$defs/message" } },
29
+ "meta": { "$ref": "#/$defs/meta" }
30
+ },
31
+ "allOf": [
32
+ {
33
+ "if": { "properties": { "status": { "const": "ok" } } },
34
+ "then": { "properties": { "complete": { "const": true }, "errors": { "maxItems": 0 }, "data": { "not": { "type": "null" } } } }
35
+ },
36
+ {
37
+ "if": { "properties": { "status": { "enum": ["incomplete", "error"] } } },
38
+ "then": { "properties": { "complete": { "const": false }, "data": { "type": "null" }, "errors": { "minItems": 1 } } }
39
+ }
40
+ ],
41
+ "$defs": {
42
+ "message": {
43
+ "type": "object",
44
+ "required": ["code", "message"],
45
+ "properties": { "code": { "type": "string" }, "message": { "type": "string" } },
46
+ "additionalProperties": false
47
+ },
48
+ "position": {
49
+ "type": "object",
50
+ "required": ["line", "column"],
51
+ "properties": { "line": { "type": "integer", "minimum": 1 }, "column": { "type": "integer", "minimum": 1 } },
52
+ "additionalProperties": false
53
+ },
54
+ "location": {
55
+ "type": "object",
56
+ "required": ["start", "end", "start_byte", "end_byte"],
57
+ "properties": {
58
+ "start": { "$ref": "#/$defs/position" },
59
+ "end": { "$ref": "#/$defs/position" },
60
+ "start_byte": { "type": "integer", "minimum": 0 },
61
+ "end_byte": { "type": "integer", "minimum": 0 }
62
+ },
63
+ "additionalProperties": false
64
+ },
65
+ "finding": {
66
+ "type": "object",
67
+ "required": ["code", "message", "location", "related_open"],
68
+ "properties": {
69
+ "code": { "type": "string" },
70
+ "message": { "type": "string" },
71
+ "location": { "$ref": "#/$defs/location" },
72
+ "related_open": { "anyOf": [{ "$ref": "#/$defs/location" }, { "type": "null" }] }
73
+ },
74
+ "additionalProperties": false
75
+ },
76
+ "source": {
77
+ "type": "object",
78
+ "required": ["path", "sha256", "byte_size", "encoding", "bom"],
79
+ "properties": {
80
+ "path": { "type": "string" },
81
+ "sha256": { "type": "string", "pattern": "^[0-9a-f]{64}$" },
82
+ "byte_size": { "type": "integer", "minimum": 0 },
83
+ "encoding": { "const": "utf-8" },
84
+ "bom": { "type": "boolean" }
85
+ },
86
+ "additionalProperties": false
87
+ },
88
+ "check_data": {
89
+ "type": "object",
90
+ "required": ["profile", "source", "verdict", "checks", "exclusions", "findings"],
91
+ "properties": {
92
+ "profile": { "const": "cfml-structure-v1" },
93
+ "source": { "$ref": "#/$defs/source" },
94
+ "verdict": { "enum": ["pass", "violations"] },
95
+ "checks": { "type": "array", "items": { "type": "string" } },
96
+ "exclusions": { "type": "array", "items": { "type": "string" } },
97
+ "findings": { "type": "array", "items": { "$ref": "#/$defs/finding" } }
98
+ },
99
+ "additionalProperties": false
100
+ },
101
+ "capabilities_data": {
102
+ "type": "object",
103
+ "required": ["profile", "operations", "extensions", "supported_tags", "limits", "exclusions"],
104
+ "properties": {
105
+ "profile": { "const": "cfml-structure-v1" },
106
+ "operations": { "type": "array", "items": { "type": "string" } },
107
+ "extensions": { "type": "array", "items": { "type": "string" } },
108
+ "supported_tags": { "type": "object" },
109
+ "limits": { "$ref": "#/$defs/limits" },
110
+ "exclusions": { "type": "array", "items": { "type": "string" } }
111
+ },
112
+ "additionalProperties": true
113
+ },
114
+ "limits": {
115
+ "type": "object",
116
+ "required": ["max_source_bytes", "max_nesting", "max_findings", "max_output_bytes", "time_limit_ms"],
117
+ "properties": {
118
+ "max_source_bytes": { "type": "integer", "minimum": 1 },
119
+ "max_nesting": { "type": "integer", "minimum": 1 },
120
+ "max_findings": { "type": "integer", "minimum": 1 },
121
+ "max_output_bytes": { "type": "integer", "minimum": 1 },
122
+ "time_limit_ms": { "type": "integer", "minimum": 1 }
123
+ },
124
+ "additionalProperties": false
125
+ },
126
+ "meta": {
127
+ "type": "object",
128
+ "required": ["scope", "limits"],
129
+ "properties": { "scope": { "type": "string" }, "limits": { "$ref": "#/$defs/limits" } },
130
+ "additionalProperties": false
131
+ }
132
+ },
133
+ "additionalProperties": false
134
+ }