@code-sentinel-cli/code-sentinel-cli 3.0.10 → 3.0.12

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 (103) hide show
  1. package/dist/bin.js +10044 -6056
  2. package/dist/builtin-rules/ai/angular/api-service-contract-risk.prompt.md +2 -2
  3. package/dist/builtin-rules/ai/angular/api-service-contract-risk.rule.yaml +3 -3
  4. package/dist/builtin-rules/ai/angular/component-state-flow.prompt.md +2 -2
  5. package/dist/builtin-rules/ai/angular/component-state-flow.rule.yaml +3 -3
  6. package/dist/builtin-rules/ai/angular/cross-feature-api-drift.prompt.md +2 -3
  7. package/dist/builtin-rules/ai/angular/cross-feature-api-drift.rule.yaml +3 -6
  8. package/dist/builtin-rules/ai/angular/cross-feature-route-permission-drift.prompt.md +2 -3
  9. package/dist/builtin-rules/ai/angular/cross-feature-route-permission-drift.rule.yaml +4 -8
  10. package/dist/builtin-rules/ai/angular/reactive-form-flow.prompt.md +2 -2
  11. package/dist/builtin-rules/ai/angular/reactive-form-flow.rule.yaml +3 -3
  12. package/dist/builtin-rules/ai/angular/route-permission-flow.prompt.md +2 -2
  13. package/dist/builtin-rules/ai/angular/route-permission-flow.rule.yaml +3 -3
  14. package/dist/builtin-rules/ai/angular/rxjs-flow-risk.prompt.md +2 -2
  15. package/dist/builtin-rules/ai/angular/rxjs-flow-risk.rule.yaml +3 -3
  16. package/dist/builtin-rules/ai/angular/template-contract-risk.prompt.md +2 -2
  17. package/dist/builtin-rules/ai/angular/template-contract-risk.rule.yaml +3 -3
  18. package/dist/builtin-rules/ai/flutter/dynamic-content-risk.prompt.md +2 -2
  19. package/dist/builtin-rules/ai/flutter/dynamic-content-risk.rule.yaml +1 -2
  20. package/dist/builtin-rules/ai/flutter/feature-state-flow-risk.prompt.md +2 -2
  21. package/dist/builtin-rules/ai/flutter/feature-state-flow-risk.rule.yaml +1 -2
  22. package/dist/builtin-rules/ai/flutter/native-platform-consistency-risk.prompt.md +2 -3
  23. package/dist/builtin-rules/ai/flutter/native-platform-consistency-risk.rule.yaml +1 -2
  24. package/dist/builtin-rules/ai/flutter/network-auth-flow-risk.prompt.md +2 -2
  25. package/dist/builtin-rules/ai/flutter/network-auth-flow-risk.rule.yaml +1 -2
  26. package/dist/builtin-rules/ai/flutter/ui-responsive-accessibility-risk.prompt.md +2 -2
  27. package/dist/builtin-rules/ai/flutter/ui-responsive-accessibility-risk.rule.yaml +0 -2
  28. package/dist/builtin-rules/ai/general/code-clarity.prompt.md +21 -4
  29. package/dist/builtin-rules/ai/general/code-clarity.rule.yaml +8 -3
  30. package/dist/builtin-rules/ai/spring-boot/business-invariant-risk.prompt.md +5 -5
  31. package/dist/builtin-rules/ai/spring-boot/business-invariant-risk.rule.yaml +1 -2
  32. package/dist/builtin-rules/ai/spring-boot/cache-consistency-risk.prompt.md +2 -2
  33. package/dist/builtin-rules/ai/spring-boot/cache-consistency-risk.rule.yaml +1 -2
  34. package/dist/builtin-rules/ai/spring-boot/cross-feature-error-handling-drift.prompt.md +2 -3
  35. package/dist/builtin-rules/ai/spring-boot/cross-feature-error-handling-drift.rule.yaml +4 -10
  36. package/dist/builtin-rules/ai/spring-boot/cross-feature-transaction-boundary-drift.prompt.md +2 -3
  37. package/dist/builtin-rules/ai/spring-boot/cross-feature-transaction-boundary-drift.rule.yaml +2 -9
  38. package/dist/builtin-rules/ai/spring-boot/error-handling-completeness.prompt.md +6 -6
  39. package/dist/builtin-rules/ai/spring-boot/error-handling-completeness.rule.yaml +1 -2
  40. package/dist/builtin-rules/ai/spring-boot/event-publishing-risk.prompt.md +2 -2
  41. package/dist/builtin-rules/ai/spring-boot/event-publishing-risk.rule.yaml +1 -2
  42. package/dist/builtin-rules/ai/spring-boot/import-template-contract-risk.prompt.md +74 -0
  43. package/dist/builtin-rules/ai/spring-boot/import-template-contract-risk.rule.yaml +24 -0
  44. package/dist/builtin-rules/ai/spring-boot/io-boundary-risk.prompt.md +2 -2
  45. package/dist/builtin-rules/ai/spring-boot/io-boundary-risk.rule.yaml +1 -2
  46. package/dist/builtin-rules/ai/spring-boot/native-dml-consistency-risk.prompt.md +75 -0
  47. package/dist/builtin-rules/ai/spring-boot/native-dml-consistency-risk.rule.yaml +24 -0
  48. package/dist/builtin-rules/ai/spring-boot/native-query-performance-risk.prompt.md +73 -0
  49. package/dist/builtin-rules/ai/spring-boot/native-query-performance-risk.rule.yaml +24 -0
  50. package/dist/builtin-rules/ai/spring-boot/ownership-scope-risk.prompt.md +5 -5
  51. package/dist/builtin-rules/ai/spring-boot/ownership-scope-risk.rule.yaml +1 -2
  52. package/dist/builtin-rules/ai/spring-boot/pagination-query-consistency-risk.prompt.md +75 -0
  53. package/dist/builtin-rules/ai/spring-boot/pagination-query-consistency-risk.rule.yaml +25 -0
  54. package/dist/builtin-rules/ai/spring-boot/pagination-risk.prompt.md +2 -2
  55. package/dist/builtin-rules/ai/spring-boot/pagination-risk.rule.yaml +1 -2
  56. package/dist/builtin-rules/ai/spring-boot/partial-update-mapper-risk.prompt.md +73 -0
  57. package/dist/builtin-rules/ai/spring-boot/partial-update-mapper-risk.rule.yaml +24 -0
  58. package/dist/builtin-rules/ai/spring-boot/query-contract-risk.prompt.md +80 -0
  59. package/dist/builtin-rules/ai/spring-boot/query-contract-risk.rule.yaml +25 -0
  60. package/dist/builtin-rules/ai/spring-boot/query-date-boundary-risk.prompt.md +74 -0
  61. package/dist/builtin-rules/ai/spring-boot/query-date-boundary-risk.rule.yaml +24 -0
  62. package/dist/builtin-rules/ai/spring-boot/security-authorization-risk.prompt.md +2 -2
  63. package/dist/builtin-rules/ai/spring-boot/security-authorization-risk.rule.yaml +3 -3
  64. package/dist/builtin-rules/ai/spring-boot/security-mass-assignment-risk.prompt.md +2 -2
  65. package/dist/builtin-rules/ai/spring-boot/security-mass-assignment-risk.rule.yaml +3 -3
  66. package/dist/builtin-rules/ai/spring-boot/security-redirect-risk.prompt.md +2 -2
  67. package/dist/builtin-rules/ai/spring-boot/security-redirect-risk.rule.yaml +1 -2
  68. package/dist/builtin-rules/ai/spring-boot/security-sensitive-data-risk.prompt.md +9 -4
  69. package/dist/builtin-rules/ai/spring-boot/security-sensitive-data-risk.rule.yaml +6 -6
  70. package/dist/builtin-rules/ai/spring-boot/soft-delete-publication-consistency-risk.prompt.md +74 -0
  71. package/dist/builtin-rules/ai/spring-boot/soft-delete-publication-consistency-risk.rule.yaml +24 -0
  72. package/dist/builtin-rules/ai/spring-boot/transaction-loop-risk.prompt.md +2 -2
  73. package/dist/builtin-rules/ai/spring-boot/transaction-loop-risk.rule.yaml +1 -2
  74. package/dist/builtin-rules/ai/spring-boot/versioned-entity-concurrency-risk.prompt.md +73 -0
  75. package/dist/builtin-rules/ai/spring-boot/versioned-entity-concurrency-risk.rule.yaml +24 -0
  76. package/dist/builtin-rules/static/angular/button-accessible-name.rule.js +143 -0
  77. package/dist/builtin-rules/static/angular/component-prefix.rule.js +6 -2
  78. package/dist/builtin-rules/static/angular/img-alt-required.rule.js +3 -2
  79. package/dist/builtin-rules/static/angular/inject-pattern.rule.js +3 -2
  80. package/dist/builtin-rules/static/angular/lifecycle-method-required.rule.js +3 -2
  81. package/dist/builtin-rules/static/angular/no-leaky-subscription.rule.js +14 -5
  82. package/dist/builtin-rules/static/angular/onpush-required.rule.js +3 -2
  83. package/dist/builtin-rules/static/angular/template-dom-xss.rule.js +3 -2
  84. package/dist/builtin-rules/static/angular/trackby-required.rule.js +3 -2
  85. package/dist/builtin-rules/static/flutter/no-undisposed-resource.rule.js +143 -0
  86. package/dist/builtin-rules/static/general/file-too-long.rule.js +5 -4
  87. package/dist/builtin-rules/static/general/function-too-long.rule.js +46 -27
  88. package/dist/builtin-rules/static/general/no-code-injection.rule.js +8 -1
  89. package/dist/builtin-rules/static/general/no-console-log.rule.js +3 -2
  90. package/dist/builtin-rules/static/general/no-empty-catch.rule.yaml +14 -8
  91. package/dist/builtin-rules/static/general/no-hardcoded-vietnamese.rule.js +58 -0
  92. package/dist/builtin-rules/static/general/no-magic-number.rule.js +151 -8
  93. package/dist/builtin-rules/static/general/no-todo-comment.rule.js +88 -0
  94. package/dist/builtin-rules/static/general/no-unused-export.rule.js +53 -6
  95. package/dist/builtin-rules/static/spring-boot/no-command-injection.rule.js +8 -1
  96. package/dist/builtin-rules/static/spring-boot/no-spel-injection.rule.js +8 -1
  97. package/dist/builtin-rules/static/spring-boot/no-sql-string-concat.rule.js +6 -1
  98. package/dist/builtin-rules/static/spring-boot/no-unzoned-datetime.rule.js +96 -0
  99. package/dist/builtin-rules/static/spring-boot/repository-naming.rule.yaml +4 -2
  100. package/dist/index.d.ts +348 -382
  101. package/dist/index.js +10045 -6057
  102. package/package.json +1 -1
  103. package/dist/builtin-rules/static/general/no-todo-comment.rule.yaml +0 -30
@@ -51,8 +51,8 @@ Trả về **JSON HỢP LỆ DUY NHẤT** (không markdown fence, không text kh
51
51
  {
52
52
  "line": <số nguyên dương, 1-based>,
53
53
  "endLine": <số nguyên dương | null>,
54
- "message": "<≤200 ký tự, tiếng Việt>",
55
- "suggestion": "<gợi ý fix | null>",
54
+ "message": "<≤200 ký tự, tiếng Việt có dấu>",
55
+ "suggestion": "<gợi ý sửa lỗi bằng tiếng Việt có dấu | null>",
56
56
  "confidence": <số nguyên 0-100>
57
57
  }
58
58
  ]
@@ -1,5 +1,6 @@
1
1
  id: angular/api-service-contract-risk
2
- version: 2
2
+ # v3 (ADR-0065 calibration): conf 60→85 (đo 26/26 TP)
3
+ version: 3
3
4
  kind: ai
4
5
  title: "Angular API service/error contract có rủi ro không?"
5
6
  description: |
@@ -14,9 +15,8 @@ severity: warning
14
15
  category: angular-api
15
16
  languages: [typescript]
16
17
  scope: angular
17
- baseConfidence: 60
18
+ baseConfidence: 85
18
19
  prompt: ./api-service-contract-risk.prompt.md
19
20
  contextScope: per-cluster
20
- maxTokens: 1600
21
21
  aiConfig:
22
22
  tier: regular
@@ -59,8 +59,8 @@ Trả về **JSON HỢP LỆ DUY NHẤT** (không markdown fence, không text kh
59
59
  {
60
60
  "line": <số nguyên dương, 1-based>,
61
61
  "endLine": <số nguyên dương | null>,
62
- "message": "<≤200 ký tự, tiếng Việt>",
63
- "suggestion": "<gợi ý fix | null>",
62
+ "message": "<≤200 ký tự, tiếng Việt có dấu>",
63
+ "suggestion": "<gợi ý sửa lỗi bằng tiếng Việt có dấu | null>",
64
64
  "confidence": <số nguyên 0-100>
65
65
  }
66
66
  ]
@@ -1,5 +1,6 @@
1
1
  id: angular/component-state-flow
2
- version: 3
2
+ # v4 (ADR-0065 calibration): conf 60→85 (đo 49/49 TP)
3
+ version: 4
3
4
  kind: ai
4
5
  title: "Angular component state/change detection flow có rủi ro không?"
5
6
  description: |
@@ -18,9 +19,8 @@ severity: warning
18
19
  category: angular-state
19
20
  languages: [typescript]
20
21
  scope: angular
21
- baseConfidence: 60
22
+ baseConfidence: 85
22
23
  prompt: ./component-state-flow.prompt.md
23
24
  contextScope: per-cluster
24
- maxTokens: 1200
25
25
  aiConfig:
26
26
  tier: regular
@@ -6,7 +6,6 @@ Bạn là senior Angular architecture reviewer. Đánh giá **một module Angul
6
6
  2. **MỖI drift pattern = ĐÚNG MỘT finding.** Nếu cùng một pattern (vd. "err.message thay vì err.error.message") xuất hiện ở nhiều file, GỘP thành **một** finding duy nhất — `file`/`line` trỏ vào file ĐẠI DIỆN rõ nhất, và liệt kê TÊN tất cả feature liên quan trong `message`. TUYỆT ĐỐI KHÔNG emit cùng pattern lặp lại một lần cho mỗi file.
7
7
  3. **`line` BẮT BUỘC là số nguyên dương** (≥ 1), trỏ vào một dòng cụ thể trong file đã chọn nơi pattern lộ rõ nhất. Nếu không chắc dòng nào → dùng `line: 1`. KHÔNG để trống, KHÔNG dùng `null`, KHÔNG dùng `0`.
8
8
  4. **`file` phải là posix path** xuất hiện trong `Module summary` bên dưới — KHÔNG fabricate path mới.
9
- 5. **Confidence `<50` → KHÔNG emit.** Ngưỡng noise thấp (`numMaxFindings: 5`).
10
9
 
11
10
  ## Chỉ flag khi có pattern lặp lại ≥ 2 feature
12
11
 
@@ -48,8 +47,8 @@ Trả về **JSON HỢP LỆ DUY NHẤT** (không markdown fence, không text kh
48
47
  "file": "<posix path trong members[]>",
49
48
  "line": <số nguyên dương, 1-based>,
50
49
  "endLine": <số nguyên dương | null>,
51
- "message": "<≤200 ký tự, tiếng Việt, mô tả pattern + tên ≥ 2 feature liên quan>",
52
- "suggestion": "<gợi ý refactor (vd. tạo wrapper service, dùng API_ROUTES) | null>",
50
+ "message": "<≤200 ký tự, tiếng Việt có dấu, mô tả mẫu hình + tên ≥ 2 tính năng liên quan>",
51
+ "suggestion": "<gợi ý tái cấu trúc bằng tiếng Việt có dấu (ví dụ: tạo wrapper service, dùng API_ROUTES) | null>",
53
52
  "confidence": <số nguyên 0-100>
54
53
  }
55
54
  ]
@@ -4,7 +4,8 @@ id: angular/cross-feature-api-drift
4
4
  # — v1 emitted the same drift once per file (5 findings = 2 real patterns); and
5
5
  # (b) stronger `line` requirement (v1 returned null/undefined line). Version bump
6
6
  # invalidates v1 cached findings.
7
- version: 2
7
+ # v3 (ADR-0065 calibration): conf 55→75 (POC gate 5/5 + field 1/1)
8
+ version: 3
8
9
  kind: ai
9
10
  title: "Angular features trong cùng module gọi /api/* không nhất quán?"
10
11
  description: |
@@ -31,12 +32,8 @@ severity: warning
31
32
  category: angular-architecture
32
33
  languages: [typescript]
33
34
  scope: angular
34
- baseConfidence: 55
35
+ baseConfidence: 75
35
36
  prompt: ./cross-feature-api-drift.prompt.md
36
37
  contextScope: per-module
37
- maxTokens: 1800
38
38
  aiConfig:
39
39
  tier: regular
40
- # Cap findings để v1 ngưỡng noise thấp; nâng lên sau khi POC gate đạt
41
- # ≥ 80% precision theo ADR-0016 §"Implementation phase".
42
- numMaxFindings: 5
@@ -7,7 +7,6 @@ Bạn là senior Angular security reviewer. Đánh giá **một module Angular**
7
7
  - **NHIỀU hành động cùng CHUNG một kiểu drift = MỘT finding.** Vd. nếu cả Delete, Export, Approve... đều "chỉ ẩn UI bằng `*hasPermission` mà thiếu code/route check" trong khi nav actions có guard → đó là **MỘT** pattern duy nhất ("in-component sensitive actions gated UI-only vs guarded nav"). Liệt kê tất cả hành động (Delete, Export, ...) trong `message`, **KHÔNG** tách mỗi hành động thành một finding riêng.
8
8
  3. **`line` BẮT BUỘC là số nguyên dương** (≥ 1), trỏ vào một dòng cụ thể trong file đã chọn nơi pattern lộ rõ nhất (vd. dòng khai báo route thiếu guard, dòng gọi action destructive không check). Nếu không chắc dòng nào → dùng `line: 1`. KHÔNG để trống, KHÔNG dùng `null`, KHÔNG dùng `0`.
9
9
  4. **`file` phải là posix path** xuất hiện trong `Module summary` bên dưới — KHÔNG fabricate path mới.
10
- 5. **Confidence `<50` → KHÔNG emit.** Ngưỡng noise thấp (`numMaxFindings: 5`).
11
10
 
12
11
  ## Chỉ flag khi có pattern lặp lại ≥ 2 feature
13
12
 
@@ -49,8 +48,8 @@ Trả về **JSON HỢP LỆ DUY NHẤT** (không markdown fence, không text kh
49
48
  "file": "<posix path trong members[]>",
50
49
  "line": <số nguyên dương, 1-based>,
51
50
  "endLine": <số nguyên dương | null>,
52
- "message": "<≤200 ký tự, tiếng Việt, mô tả pattern drift + tên ≥ 2 feature liên quan>",
53
- "suggestion": "<gợi ý refactor (vd. áp cùng guard, chuẩn hóa data.permissions, thêm code-level check) | null>",
51
+ "message": "<≤200 ký tự, tiếng Việt có dấu, mô tả sai lệch mẫu hình + tên ≥ 2 tính năng liên quan>",
52
+ "suggestion": "<gợi ý tái cấu trúc bằng tiếng Việt có dấu (ví dụ: áp cùng guard, chuẩn hóa data.permissions, thêm kiểm tra trong mã) | null>",
54
53
  "confidence": <số nguyên 0-100>
55
54
  }
56
55
  ]
@@ -7,9 +7,9 @@ id: angular/cross-feature-route-permission-drift
7
7
  # export) — v2 CRITICAL RULE: multiple actions sharing one drift mechanism =
8
8
  # ONE finding (list all actions in the message). Version bump invalidates v1
9
9
  # cached findings.
10
- # Second rule in the per-module family (ADR-0016); same POC discipline as
11
- # cross-feature-api-drift (small numMaxFindings + sandwich prompt).
12
- version: 2
10
+ # Second rule in the per-module family (ADR-0016).
11
+ # v3 (ADR-0065 calibration): conf 55→75 (POC gate 2/2).
12
+ version: 3
13
13
  kind: ai
14
14
  title: "Angular features trong cùng module bảo vệ route / permission không nhất quán?"
15
15
  description: |
@@ -39,12 +39,8 @@ severity: warning
39
39
  category: angular-architecture
40
40
  languages: [typescript]
41
41
  scope: angular
42
- baseConfidence: 55
42
+ baseConfidence: 75
43
43
  prompt: ./cross-feature-route-permission-drift.prompt.md
44
44
  contextScope: per-module
45
- maxTokens: 1800
46
45
  aiConfig:
47
46
  tier: regular
48
- # Cap findings để v1 ngưỡng noise thấp; nâng lên sau khi POC gate đạt
49
- # ≥ 80% precision theo ADR-0016 §"Implementation phase".
50
- numMaxFindings: 5
@@ -62,8 +62,8 @@ Trả về **JSON HỢP LỆ DUY NHẤT** (không markdown fence, không text kh
62
62
  {
63
63
  "line": <số nguyên dương, 1-based>,
64
64
  "endLine": <số nguyên dương | null>,
65
- "message": "<≤200 ký tự, tiếng Việt>",
66
- "suggestion": "<gợi ý fix | null>",
65
+ "message": "<≤200 ký tự, tiếng Việt có dấu>",
66
+ "suggestion": "<gợi ý sửa lỗi bằng tiếng Việt có dấu | null>",
67
67
  "confidence": <số nguyên 0-100>
68
68
  }
69
69
  ]
@@ -1,5 +1,6 @@
1
1
  id: angular/reactive-form-flow
2
- version: 4
2
+ # v5 (ADR-0065 calibration): conf 60→85 (đo 46/46 TP)
3
+ version: 5
3
4
  kind: ai
4
5
  title: "Angular reactive form flow có rủi ro submit/validation không?"
5
6
  description: |
@@ -15,9 +16,8 @@ severity: warning
15
16
  category: angular-form
16
17
  languages: [typescript]
17
18
  scope: angular
18
- baseConfidence: 60
19
+ baseConfidence: 85
19
20
  prompt: ./reactive-form-flow.prompt.md
20
21
  contextScope: per-cluster
21
- maxTokens: 1600
22
22
  aiConfig:
23
23
  tier: regular
@@ -58,8 +58,8 @@ Trả về **JSON HỢP LỆ DUY NHẤT** (không markdown fence, không text kh
58
58
  {
59
59
  "line": <số nguyên dương, 1-based>,
60
60
  "endLine": <số nguyên dương | null>,
61
- "message": "<≤200 ký tự, tiếng Việt>",
62
- "suggestion": "<gợi ý fix | null>",
61
+ "message": "<≤200 ký tự, tiếng Việt có dấu>",
62
+ "suggestion": "<gợi ý sửa lỗi bằng tiếng Việt có dấu | null>",
63
63
  "confidence": <số nguyên 0-100>
64
64
  }
65
65
  ]
@@ -1,5 +1,6 @@
1
1
  id: angular/route-permission-flow
2
- version: 4
2
+ # v5 (ADR-0065 calibration): conf 60→85 (đo 21/21 TP)
3
+ version: 5
3
4
  kind: ai
4
5
  title: "Angular route/permission/UI action flow có rủi ro phân quyền không?"
5
6
  description: |
@@ -15,9 +16,8 @@ severity: warning
15
16
  category: angular-security
16
17
  languages: [typescript]
17
18
  scope: angular
18
- baseConfidence: 60
19
+ baseConfidence: 85
19
20
  prompt: ./route-permission-flow.prompt.md
20
21
  contextScope: per-cluster
21
- maxTokens: 1600
22
22
  aiConfig:
23
23
  tier: regular
@@ -61,8 +61,8 @@ Trả về **JSON HỢP LỆ DUY NHẤT** (không markdown fence, không text kh
61
61
  {
62
62
  "line": <số nguyên dương, 1-based>,
63
63
  "endLine": <số nguyên dương | null>,
64
- "message": "<≤200 ký tự, tiếng Việt>",
65
- "suggestion": "<gợi ý fix | null>",
64
+ "message": "<≤200 ký tự, tiếng Việt có dấu>",
65
+ "suggestion": "<gợi ý sửa lỗi bằng tiếng Việt có dấu | null>",
66
66
  "confidence": <số nguyên 0-100>
67
67
  }
68
68
  ]
@@ -1,5 +1,6 @@
1
1
  id: angular/rxjs-flow-risk
2
- version: 4
2
+ # v5 (ADR-0065 calibration): conf 60→90 (đo 233/233 TP — rule AI bị định giá thấp nhất catalog)
3
+ version: 5
3
4
  kind: ai
4
5
  title: "Angular RxJS async flow có rủi ro không?"
5
6
  description: |
@@ -16,9 +17,8 @@ severity: warning
16
17
  category: async-flow
17
18
  languages: [typescript]
18
19
  scope: angular
19
- baseConfidence: 60
20
+ baseConfidence: 90
20
21
  prompt: ./rxjs-flow-risk.prompt.md
21
22
  contextScope: per-cluster
22
- maxTokens: 1200
23
23
  aiConfig:
24
24
  tier: regular
@@ -57,8 +57,8 @@ Trả về **JSON HỢP LỆ DUY NHẤT** (không markdown fence, không text kh
57
57
  {
58
58
  "line": <số nguyên dương, 1-based>,
59
59
  "endLine": <số nguyên dương | null>,
60
- "message": "<≤200 ký tự, tiếng Việt>",
61
- "suggestion": "<gợi ý fix | null>",
60
+ "message": "<≤200 ký tự, tiếng Việt có dấu>",
61
+ "suggestion": "<gợi ý sửa lỗi bằng tiếng Việt có dấu | null>",
62
62
  "confidence": <số nguyên 0-100>
63
63
  }
64
64
  ]
@@ -1,5 +1,6 @@
1
1
  id: angular/template-contract-risk
2
- version: 4
2
+ # v5 (ADR-0065 calibration): conf 60→70 (đo 7/7 TP — mẫu nhỏ, nâng dè dặt)
3
+ version: 5
3
4
  kind: ai
4
5
  title: "Angular template/component contract có rủi ro runtime không?"
5
6
  description: |
@@ -17,9 +18,8 @@ severity: warning
17
18
  category: angular-template
18
19
  languages: [typescript]
19
20
  scope: angular
20
- baseConfidence: 60
21
+ baseConfidence: 70
21
22
  prompt: ./template-contract-risk.prompt.md
22
23
  contextScope: per-cluster
23
- maxTokens: 1200
24
24
  aiConfig:
25
25
  tier: regular
@@ -42,8 +42,8 @@ Trả về JSON hợp lệ duy nhất:
42
42
  {
43
43
  "line": 1,
44
44
  "endLine": null,
45
- "message": "<≤200 ký tự, tiếng Việt>",
46
- "suggestion": "<gợi ý fix | null>",
45
+ "message": "<≤200 ký tự, tiếng Việt có dấu>",
46
+ "suggestion": "<gợi ý sửa lỗi bằng tiếng Việt có dấu | null>",
47
47
  "confidence": 0
48
48
  }
49
49
  ]
@@ -1,5 +1,5 @@
1
1
  id: flutter/dynamic-content-risk
2
- version: 1
2
+ version: 2
3
3
  kind: ai
4
4
  title: "Flutter dynamic content/file flow có rủi ro không?"
5
5
  description: |
@@ -12,7 +12,6 @@ scope: flutter
12
12
  baseConfidence: 60
13
13
  prompt: ./dynamic-content-risk.prompt.md
14
14
  contextScope: per-cluster
15
- maxTokens: 1400
16
15
  aiConfig:
17
16
  tier: regular
18
17
 
@@ -45,8 +45,8 @@ Trả về JSON hợp lệ duy nhất:
45
45
  {
46
46
  "line": 1,
47
47
  "endLine": null,
48
- "message": "<≤200 ký tự, tiếng Việt>",
49
- "suggestion": "<gợi ý fix | null>",
48
+ "message": "<≤200 ký tự, tiếng Việt có dấu>",
49
+ "suggestion": "<gợi ý sửa lỗi bằng tiếng Việt có dấu | null>",
50
50
  "confidence": 0
51
51
  }
52
52
  ]
@@ -1,5 +1,5 @@
1
1
  id: flutter/feature-state-flow-risk
2
- version: 1
2
+ version: 2
3
3
  kind: ai
4
4
  title: "Flutter feature state/API flow có rủi ro không?"
5
5
  description: |
@@ -12,7 +12,6 @@ scope: flutter
12
12
  baseConfidence: 60
13
13
  prompt: ./feature-state-flow-risk.prompt.md
14
14
  contextScope: per-cluster
15
- maxTokens: 1400
16
15
  aiConfig:
17
16
  tier: regular
18
17
 
@@ -42,8 +42,8 @@ Trả về JSON hợp lệ duy nhất:
42
42
  {
43
43
  "line": 1,
44
44
  "endLine": null,
45
- "message": "<≤200 ký tự, tiếng Việt>",
46
- "suggestion": "<gợi ý fix | null>",
45
+ "message": "<≤200 ký tự, tiếng Việt có dấu>",
46
+ "suggestion": "<gợi ý sửa lỗi bằng tiếng Việt có dấu | null>",
47
47
  "confidence": 0
48
48
  }
49
49
  ]
@@ -53,4 +53,3 @@ Trả về JSON hợp lệ duy nhất:
53
53
  Nếu không có vấn đề rõ: `{"violations": []}`.
54
54
 
55
55
  Đừng giải thích. JSON thuần.
56
-
@@ -1,5 +1,5 @@
1
1
  id: flutter/native-platform-consistency-risk
2
- version: 1
2
+ version: 2
3
3
  kind: ai
4
4
  title: "Flutter Dart/native permission config có lệch nhau không?"
5
5
  description: |
@@ -12,7 +12,6 @@ scope: flutter
12
12
  baseConfidence: 58
13
13
  prompt: ./native-platform-consistency-risk.prompt.md
14
14
  contextScope: per-cluster
15
- maxTokens: 1500
16
15
  aiConfig:
17
16
  tier: regular
18
17
 
@@ -44,8 +44,8 @@ Trả về JSON hợp lệ duy nhất:
44
44
  {
45
45
  "line": 1,
46
46
  "endLine": null,
47
- "message": "<≤200 ký tự, tiếng Việt>",
48
- "suggestion": "<gợi ý fix | null>",
47
+ "message": "<≤200 ký tự, tiếng Việt có dấu>",
48
+ "suggestion": "<gợi ý sửa lỗi bằng tiếng Việt có dấu | null>",
49
49
  "confidence": 0
50
50
  }
51
51
  ]
@@ -1,5 +1,5 @@
1
1
  id: flutter/network-auth-flow-risk
2
- version: 1
2
+ version: 2
3
3
  kind: ai
4
4
  title: "Flutter network/auth flow có rủi ro không?"
5
5
  description: |
@@ -13,7 +13,6 @@ scope: flutter
13
13
  baseConfidence: 60
14
14
  prompt: ./network-auth-flow-risk.prompt.md
15
15
  contextScope: per-cluster
16
- maxTokens: 1400
17
16
  aiConfig:
18
17
  tier: regular
19
18
 
@@ -45,8 +45,8 @@ Trả về JSON hợp lệ duy nhất:
45
45
  {
46
46
  "line": 1,
47
47
  "endLine": null,
48
- "message": "<≤200 ký tự, tiếng Việt>",
49
- "suggestion": "<gợi ý fix | null>",
48
+ "message": "<≤200 ký tự, tiếng Việt có dấu>",
49
+ "suggestion": "<gợi ý sửa lỗi bằng tiếng Việt có dấu | null>",
50
50
  "confidence": 0,
51
51
  "rootCauseKey": "<kebab-case pattern, optional>",
52
52
  "tags": ["flutter-ui"]
@@ -12,7 +12,5 @@ scope: flutter
12
12
  baseConfidence: 70
13
13
  prompt: ./ui-responsive-accessibility-risk.prompt.md
14
14
  contextScope: per-cluster
15
- maxTokens: 1400
16
15
  aiConfig:
17
16
  tier: regular
18
- numMaxFindings: 3
@@ -2,7 +2,7 @@ Bạn là senior code reviewer. Đánh giá đoạn TypeScript/JavaScript dướ
2
2
 
3
3
  ## Tiêu chí flag (chỉ flag khi RÕ RÀNG có vấn đề)
4
4
 
5
- - Tên hàm hoặc biến không nói lên ý nghĩa (1-2 ký tự không phải `i`/`j`/`k` trong loop, hoặc `tmp` / `data` / `result` không có ngữ cảnh).
5
+ - Tên hàm hoặc biến không nói lên ý nghĩa (1-2 ký tự, hoặc `tmp` / `data` / `result` không có ngữ cảnh). **Đọc kỹ mục "KHÔNG flag" bên dưới trước khi flag một tên ngắn — phần lớn tên ngắn trong code thật là hợp lệ.**
6
6
  - Logic lồng quá sâu (≥4 cấp if/for/try).
7
7
  - Comment giải thích cái đã rõ trong code (kiểu `// increment i`), hoặc comment lệch hành vi.
8
8
  - String literal bí ẩn làm code khó hiểu khi **không** phải route path, event name, i18n key, enum-like value, test fixture, hoặc message hiển thị.
@@ -12,7 +12,17 @@ Bạn là senior code reviewer. Đánh giá đoạn TypeScript/JavaScript dướ
12
12
  - Function nội bộ tầm thường (helper 1-2 dòng).
13
13
  - Test/spec files (*.test.ts, *.spec.ts, __tests__).
14
14
  - Generated code.
15
- - Tên ngắn nhưng theo convention rộng rãi (`i` trong loop, `e` trong catch).
15
+ - Tên ngắn nhưng theo convention rộng rãi (`i`/`j`/`k` trong loop, `e` trong catch).
16
+ - **Bí danh (alias) cho một symbol đã import** — `const R = VauthzResource;`,
17
+ `protected readonly R = SomeEnum;`, `const t = this.translate;`. Kể cả tên 1
18
+ ký tự. Giá trị được gán ĐÃ tự nói lên ý nghĩa ngay trên cùng dòng, và alias
19
+ ngắn thường tồn tại để biểu thức trong template đọc được. Đây là nhóm báo sai
20
+ LỚN NHẤT của rule này trên code thật — đừng flag nó.
21
+ - **Tham số 1 ký tự trong callback ngắn** — `.map(b => b.brand)`,
22
+ `.find(o => o.id === id)`, `.filter(v => v !== x)`, `.reduce((a, c) => ...)`.
23
+ Là cú pháp chuẩn của JS/TS khi thân hàm chỉ một biểu thức.
24
+ - **Biến cục bộ 1 ký tự cho một API DOM/thư viện quen thuộc** trong 2-3 dòng
25
+ liền kề — `const a = document.createElement('a'); a.href = url; a.click();`.
16
26
 
17
27
  ## Code cần review
18
28
 
@@ -33,8 +43,8 @@ Trả về **JSON HỢP LỆ DUY NHẤT** (không markdown fence, không text kh
33
43
  {
34
44
  "line": <số nguyên dương, 1-based>,
35
45
  "endLine": <số nguyên dương | null>,
36
- "message": "<≤200 ký tự, tiếng Việt>",
37
- "suggestion": "<gợi ý fix | null>",
46
+ "message": "<≤200 ký tự, tiếng Việt có dấu>",
47
+ "suggestion": "<gợi ý sửa lỗi bằng tiếng Việt có dấu | null>",
38
48
  "confidence": <số nguyên 0-100>
39
49
  }
40
50
  ]
@@ -52,6 +62,13 @@ Trả về **JSON HỢP LỆ DUY NHẤT** (không markdown fence, không text kh
52
62
 
53
63
  KHÔNG inflate confidence. Một finding `confidence: 100` phải là vấn đề mà bất kỳ senior reviewer nào cũng đồng ý cần fix. Nếu có chỗ đáng review nhưng có thể là intentional → confidence 50-70.
54
64
 
65
+ ### Gộp trùng lặp
66
+
67
+ Nếu CÙNG MỘT vấn đề lặp lại nhiều lần trong file (cùng tên biến, cùng kiểu
68
+ comment), trả về **MỘT** violation ở lần xuất hiện đầu tiên và nói rõ trong
69
+ `message` là nó lặp ở bao nhiêu chỗ. Đừng trả N violation cho N dòng của cùng
70
+ một nguyên nhân.
71
+
55
72
  Nếu code đã rõ ràng và không có vi phạm: `{"violations": []}`.
56
73
 
57
74
  Đừng giải thích. JSON thuần.
@@ -1,5 +1,11 @@
1
1
  id: general/code-clarity
2
- version: 3
2
+ # v4 (ADR-0065): ba carve-out theo số đo thực địa. Đo trên hai module Angular
3
+ # sản xuất: 412 finding, 40 bị bác = precision 90,3 % — cao hơn nhiều so với
4
+ # baseConfidence 60 mà v3 khai báo, nên số đó nâng lên 75. 27/40 FP là CÙNG
5
+ # MỘT pattern (`const R = VauthzResource`) lặp ở 27 file; 6 FP là param 1 ký
6
+ # tự trong callback (`.map(b => b.brand)`). Cả hai đều là quy ước hợp lệ,
7
+ # prompt v4 miễn tường minh.
8
+ version: 4
3
9
  kind: ai
4
10
  title: "Code có rõ ràng và dễ đọc không?"
5
11
  description: |
@@ -14,7 +20,6 @@ severity: warning
14
20
  category: readability
15
21
  languages: [typescript, javascript]
16
22
  scope: general
17
- baseConfidence: 60
23
+ baseConfidence: 75
18
24
  prompt: ./code-clarity.prompt.md
19
25
  contextScope: per-file
20
- maxTokens: 900
@@ -8,7 +8,7 @@ CRITICAL NON-VIOLATIONS:
8
8
  - NEVER report mass assignment by itself; `security-mass-assignment-risk` owns request body fields such as `id`, `tenantId`, `accountId`, `role`, `admin`, or entity `status` accepted during create/update.
9
9
  - NEVER report transaction/loop/SSRF/filesystem/error-handling issues here.
10
10
  - NEVER report DTO validation/style/naming issues; static rules own those.
11
- - NEVER report benchmark negative controls (`SafeOperationsController`, `SafeOperationsService`, `ApiExceptionAdvice`, DTOs under `com.benchmark.badmvc.dto`) unless PRIMARY shows direct business-state mutation evidence.
11
+ - NEVER report a file that only plays a supporting/evidence role (a global exception handler, a DTO, a class the cluster shows as the safe path) unless PRIMARY itself shows direct business-state mutation evidence.
12
12
 
13
13
  1. **CHI report loi co bang chung cu the** trong PRIMARY hoac support files. Khong doan convention ngoai cluster.
14
14
  2. **`line` BAT BUOC tro ve PRIMARY controller file**. Neu invariant bi bypass trong service, dung dong controller goi flow do.
@@ -30,7 +30,7 @@ CRITICAL NON-VIOLATIONS:
30
30
  - Request value chi la filter/search, khong mutate persisted state hoac side effect.
31
31
  - Enum/status duoc validate bang allowlist, transition table, domain method (`approve`, `cancel`, `refund`) co guard current state.
32
32
  - Fixed server-driven status transition nhu `setStatus("APPROVED")`, `setStatus("PAID")`, `setStatus("CANCELLED")` neu khong co request-controlled target/metadata hoac explicit transition contract visible.
33
- - Safe DTO flow, `SafeOperations*`, hoac `ApiExceptionAdvice` support-only file neu khong co direct business-state mutation evidence trong PRIMARY.
33
+ - Luong DTO an toan, hoac file support-only (global exception handler, mapper, config) neu khong co direct business-state mutation evidence trong PRIMARY.
34
34
  - Pure ownership/tenant/auth gap, transaction gap, SSRF/file boundary, raw exception response.
35
35
  - Style/naming/refactor suggestion.
36
36
 
@@ -63,8 +63,8 @@ Tra ve **JSON HOP LE DUY NHAT** (khong markdown fence, khong text khac) theo sch
63
63
  {
64
64
  "line": <so nguyen duong, 1-based, trong PRIMARY>,
65
65
  "endLine": <so nguyen duong | null>,
66
- "message": "<<=200 ky tu, tieng Viet, neu request-controlled state + invariant bi bypass>",
67
- "suggestion": "<goi y fix | null>",
66
+ "message": "<≤200 ký tự, tiếng Việt có dấu, nêu trạng thái do request điều khiển và invariant bị bỏ qua>",
67
+ "suggestion": "<gợi ý sửa lỗi bằng tiếng Việt có dấu | null>",
68
68
  "confidence": <so nguyen 0-100>
69
69
  }
70
70
  ]
@@ -79,7 +79,7 @@ Neu khong co business invariant bug ro rang: `{"violations": []}`.
79
79
  - Chi report khi request-controlled/free-text value hoac blind recalculation co the bypass domain invariant ro rang.
80
80
  - Khong report mass assignment/auth/ownership/current-user policy gap trong rule nay.
81
81
  - Khong report fixed server-driven status transition chi vi thieu current-state check.
82
- - Khong flag benchmark negative controls: `SafeOperationsController`, `SafeOperationsService`, `ApiExceptionAdvice`, DTO safe flow, tru khi PRIMARY co direct invariant mutation evidence.
82
+ - Khong flag file support-only (global exception handler, DTO, luong an toan) tru khi PRIMARY co direct invariant mutation evidence.
83
83
  - Khong duplicate static rules hoac `ownership-scope-risk`, `io-boundary-risk`, `transaction-loop-risk`, `security-authorization-risk`, `security-mass-assignment-risk`, `error-handling-completeness`.
84
84
  - Confidence `<50` -> KHONG emit.
85
85
 
@@ -1,5 +1,5 @@
1
1
  id: spring-boot/business-invariant-risk
2
- version: 2
2
+ version: 3
3
3
  kind: ai
4
4
  title: "Spring Boot business invariant/state transition co rui ro khong?"
5
5
  description: |
@@ -14,7 +14,6 @@ scope: spring-boot
14
14
  baseConfidence: 60
15
15
  prompt: ./business-invariant-risk.prompt.md
16
16
  contextScope: per-cluster
17
- maxTokens: 1800
18
17
  aiConfig:
19
18
  tier: regular
20
19
  prRouting:
@@ -60,8 +60,8 @@ Tra ve **JSON HOP LE DUY NHAT** (khong markdown fence, khong text khac) theo sch
60
60
  {
61
61
  "line": <so nguyen duong, 1-based, trong PRIMARY>,
62
62
  "endLine": <so nguyen duong | null>,
63
- "message": "<<=200 ky tu, tieng Viet, neu cache stale/collision gap>",
64
- "suggestion": "<goi y fix | null>",
63
+ "message": "<≤200 ký tự, tiếng Việt có dấu, nêu nguy cơ cache cũ hoặc xung đột khóa>",
64
+ "suggestion": "<gợi ý sửa lỗi bằng tiếng Việt có dấu | null>",
65
65
  "confidence": <so nguyen 0-100>
66
66
  }
67
67
  ]
@@ -1,5 +1,5 @@
1
1
  id: spring-boot/cache-consistency-risk
2
- version: 1
2
+ version: 2
3
3
  kind: ai
4
4
  title: "Cache Consistency"
5
5
  description: |
@@ -14,7 +14,6 @@ scope: spring-boot
14
14
  baseConfidence: 60
15
15
  prompt: ./cache-consistency-risk.prompt.md
16
16
  contextScope: per-cluster
17
- maxTokens: 1800
18
17
  aiConfig:
19
18
  tier: regular
20
19
  prRouting:
@@ -7,7 +7,6 @@ Bạn là senior Spring Boot reviewer. Đánh giá **một module Spring Boot**
7
7
  - **NHIỀU method / endpoint cùng CHUNG một kiểu drift = MỘT finding.** Vd. nếu nhiều method trong cùng một controller đều "trả `ResponseEntity<String>` raw thay vì error shape chuẩn của module" → đó là **MỘT** pattern duy nhất. Liệt kê các method trong `message`, **KHÔNG** tách mỗi method thành một finding riêng.
8
8
  3. **`line` BẮT BUỘC là số nguyên dương** (≥ 1), trỏ vào một dòng cụ thể trong file đã chọn nơi pattern lộ rõ nhất (vd. dòng `catch (Exception e)`, dòng `return ResponseEntity.status(500)...`, dòng method handler lệch chuẩn). Nếu không chắc dòng nào → dùng `line: 1`. KHÔNG để trống, KHÔNG dùng `null`, KHÔNG dùng `0`.
9
9
  4. **`file` phải là posix path** xuất hiện trong `Module summary` bên dưới — KHÔNG fabricate path mới.
10
- 5. **Confidence `<50` → KHÔNG emit.** Ngưỡng noise thấp (`numMaxFindings: 5`).
11
10
 
12
11
  ## Chỉ flag khi có pattern lặp lại ≥ 2 feature (cùng resource)
13
12
 
@@ -52,8 +51,8 @@ Trả về **JSON HỢP LỆ DUY NHẤT** (không markdown fence, không text kh
52
51
  "file": "<posix path trong members[]>",
53
52
  "line": <số nguyên dương, 1-based>,
54
53
  "endLine": <số nguyên dương | null>,
55
- "message": "<≤200 ký tự, tiếng Việt, mô tả pattern drift + tên ≥ 2 controller liên quan>",
56
- "suggestion": "<gợi ý refactor (vd. dùng chung @RestControllerAdvice, chuẩn hóa error shape, map exception → status thống nhất) | null>",
54
+ "message": "<≤200 ký tự, tiếng Việt có dấu, mô tả sai lệch mẫu hình + tên ≥ 2 controller liên quan>",
55
+ "suggestion": "<gợi ý tái cấu trúc bằng tiếng Việt có dấu (ví dụ: dùng chung @RestControllerAdvice, chuẩn hóa cấu trúc lỗi, ánh xạ exception → status thống nhất) | null>",
57
56
  "confidence": <số nguyên 0-100>
58
57
  }
59
58
  ]
@@ -1,13 +1,11 @@
1
1
  id: spring-boot/cross-feature-error-handling-drift
2
2
  # v1 (Phase 15.5.3): third rule in the per-module family (ADR-0016), first
3
3
  # Spring Boot per-module rule. Mirrors the validated cross-feature-api-drift /
4
- # cross-feature-route-permission-drift shape byte-for-byte (same contextScope,
5
- # numMaxFindings, sandwich prompt, one-finding-per-pattern + line >= 1 +
6
- # file in members[] requirements). Detects INCONSISTENT exception-handling /
4
+ # cross-feature-route-permission-drift shape: per-module context, sandwich
5
+ # prompt, one-finding-per-pattern, and file-in-members requirements. Detects
6
+ # INCONSISTENT exception-handling /
7
7
  # @ExceptionHandler registration across >= 2 controllers (features) of one
8
- # module serving the same resource. POC gate (>= 80% precision on a small
9
- # Viettel Spring module) still pending — keep numMaxFindings small until it
10
- # passes per ADR-0016 §"Implementation phase".
8
+ # module serving the same resource.
11
9
  # Expect a likely v1->v2 dedup pass after the gate run (the GLM-4.7
12
10
  # over-split quirk recurred on both prior per-module rules even with the
13
11
  # one-finding-per-pattern instruction — see DEVELOPMENT.md Phase 15.5.3).
@@ -55,9 +53,5 @@ scope: spring-boot
55
53
  baseConfidence: 55
56
54
  prompt: ./cross-feature-error-handling-drift.prompt.md
57
55
  contextScope: per-module
58
- maxTokens: 1800
59
56
  aiConfig:
60
57
  tier: regular
61
- # Cap findings để v1 ngưỡng noise thấp; nâng lên sau khi POC gate đạt
62
- # ≥ 80% precision theo ADR-0016 §"Implementation phase".
63
- numMaxFindings: 5