@codacy/gate-cli 0.1.0 → 0.3.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,141 @@
1
+ # GATE.md — Standard Template
2
+ # YAML skeleton used by /gate-setup to generate .gate/standard.yaml
3
+ # All fields with empty values are populated during synthesis.
4
+ # See STANDARDS-SPEC.md section 2 for the full schema.
5
+
6
+ version: "1.0.0"
7
+ created_by: ""
8
+
9
+ # Project metadata — populated from codebase analysis
10
+ knowledge_spec:
11
+ project_name: ""
12
+ languages: []
13
+ frameworks: []
14
+ architecture: "" # monorepo | monolith | microservices
15
+ build_system: "" # npm | yarn | pnpm | pip | go | maven | gradle
16
+ test_framework: "" # vitest | jest | pytest | go test | junit
17
+
18
+ # Quality assessment dimensions (always 4)
19
+ # Thresholds from patterns-reference.yaml, adjusted per codebase
20
+ quality_dimensions:
21
+ - id: comprehensibility
22
+ description: "Code readable in one context load"
23
+ signals:
24
+ - metric: file_length
25
+ threshold: 300
26
+ unit: lines
27
+ rationale: "AI context windows degrade on large files"
28
+ - metric: cyclomatic_complexity
29
+ threshold: 15
30
+ unit: per_function
31
+ rationale: "Complexity-aware feedback improves AI performance by 35.71%"
32
+ - metric: function_length
33
+ threshold: 50
34
+ unit: lines
35
+ rationale: "Short functions are easier for agents to modify safely"
36
+ - metric: naming_quality
37
+ tool: ai
38
+ rationale: "Descriptive names improve AI comprehension by 2x"
39
+
40
+ - id: modularity
41
+ description: "Modify one concern without touching 3+ files"
42
+ signals:
43
+ - metric: single_responsibility
44
+ tool: ai
45
+ rationale: "AI performance drops sharply at 3+ files per change"
46
+ - metric: shallow_abstractions
47
+ tool: ai
48
+ rationale: "LLMs struggle with deep inheritance hierarchies"
49
+
50
+ - id: type_safety
51
+ description: "Type system catches errors before runtime"
52
+ signals: [] # Populated per-language during synthesis
53
+
54
+ - id: test_adequacy
55
+ description: "Tests define expected behavior for agents"
56
+ signals:
57
+ - metric: test_coverage
58
+ threshold: 80
59
+ unit: percent
60
+ ai_threshold: 90
61
+ rationale: "90% recommended for AI-generated code"
62
+ - metric: test_quality
63
+ tool: ai
64
+ rationale: "Tests are the primary safety net for AI agents"
65
+
66
+ # Security patterns (CWE-mapped, always all 7)
67
+ security_patterns:
68
+ - id: no-hardcoded-secrets
69
+ description: "No secrets, API keys, passwords, or tokens in source code"
70
+ severity: critical
71
+ cwe: [CWE-798]
72
+ enforced_by: [] # Populated with Trivy/Semgrep during synthesis
73
+
74
+ - id: input-sanitization
75
+ description: "All user input validated and sanitized before use"
76
+ severity: critical
77
+ cwe: [CWE-20, CWE-80, CWE-89, CWE-117]
78
+ enforced_by: []
79
+
80
+ - id: parameterized-queries
81
+ description: "Database queries use parameters, never string concatenation"
82
+ severity: critical
83
+ cwe: [CWE-89]
84
+ enforced_by: []
85
+
86
+ - id: dependency-verification
87
+ description: "No known-vulnerable dependencies"
88
+ severity: high
89
+ cwe: [CWE-1395]
90
+ enforced_by: []
91
+
92
+ - id: no-unsafe-deserialization
93
+ description: "No unsafe deserialization of untrusted data"
94
+ severity: high
95
+ cwe: [CWE-502]
96
+ enforced_by: []
97
+
98
+ - id: access-control-checks
99
+ description: "Authorization verified on all sensitive operations"
100
+ severity: high
101
+ cwe: [CWE-639]
102
+ enforced_by: [] # AI-only — requires business context
103
+
104
+ - id: config-file-integrity
105
+ description: "Configuration files not manipulable by untrusted input"
106
+ severity: high
107
+ cwe: [CWE-15]
108
+ enforced_by: [] # AI-only
109
+
110
+ # Project-specific patterns (2-5, synthesized during setup)
111
+ custom_patterns: []
112
+ # Example:
113
+ # - id: auth-middleware-required
114
+ # description: "All API routes must use authentication middleware"
115
+ # severity: high
116
+ # enforced_by: []
117
+ # rationale: "Project uses express with JWT auth"
118
+
119
+ # Process constraints
120
+ process_constraints:
121
+ self_healing_limit: 2 # Max fix-recheck iterations (research: degradation after 2)
122
+ analysis_mode: balanced # lightweight | balanced | thorough
123
+ exclude_paths:
124
+ - node_modules
125
+ - dist
126
+ - build
127
+ - .git
128
+ - vendor
129
+ - __pycache__
130
+ - .next
131
+ - coverage
132
+
133
+ # Tool configuration (populated during synthesis based on detected languages)
134
+ tool_configuration: {}
135
+ # Example:
136
+ # eslint:
137
+ # enabled: true
138
+ # config_file: ".gate/tools/eslint.config.mjs"
139
+ # semgrep:
140
+ # enabled: true
141
+ # rulesets: ["p/security-audit", "p/typescript"]
@@ -0,0 +1,45 @@
1
+ # /gate-status — Show GATE.md quality status
2
+
3
+ You are showing the current GATE.md quality status for this project. This gives a quick overview of project health without running a new analysis.
4
+
5
+ ---
6
+
7
+ ## Step 1: Check configuration
8
+
9
+ Verify `gate` CLI is available: `which gate`. If not: "Re-run the GATE.md installer."
10
+
11
+ ---
12
+
13
+ ## Step 2: Fetch and display status
14
+
15
+ Run:
16
+ ```bash
17
+ gate status --history
18
+ ```
19
+
20
+ This fetches the project memory context (standard info, last run, trends, pending items) and recent run history, then displays a formatted summary.
21
+
22
+ **If the service is unreachable**: the CLI falls back to showing local data with an offline note.
23
+
24
+ **If not configured**: the CLI prints "GATE.md is not configured for this project. Run /gate-setup."
25
+
26
+ ---
27
+
28
+ ## Step 3: Interpret for the user
29
+
30
+ After showing the raw status output, provide a brief interpretation:
31
+
32
+ - If **declining trend**: "Quality is trending down. Consider running `/gate-analyze` to identify issues."
33
+ - If **pending items exist**: "There are N pending items to address."
34
+ - If **no runs**: "No analyses recorded yet. The hook will run automatically on your next stop, or use `/gate-analyze`."
35
+ - If **PASS with improving trend**: "Project quality is good and improving."
36
+
37
+ ---
38
+
39
+ ## For JSON output (programmatic use)
40
+
41
+ ```bash
42
+ gate status --history --json
43
+ ```
44
+
45
+ Returns structured JSON with `memory` and `runs` fields.
package/package.json CHANGED
@@ -1,12 +1,13 @@
1
1
  {
2
2
  "name": "@codacy/gate-cli",
3
- "version": "0.1.0",
3
+ "version": "0.3.0",
4
4
  "description": "CLI for GATE.md quality gate service",
5
5
  "bin": {
6
6
  "gate": "./bin/gate.js"
7
7
  },
8
8
  "files": [
9
9
  "bin/gate.js",
10
+ "data/skills/",
10
11
  "package.json",
11
12
  "README.md"
12
13
  ],