@yinuo-ngm/mcp-server 0.1.2 → 0.1.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.
Files changed (214) hide show
  1. package/README.md +191 -208
  2. package/lib/audit/audit-event.d.ts +14 -0
  3. package/lib/audit/audit-event.js +2 -0
  4. package/lib/audit/audit-log.service.d.ts +7 -0
  5. package/lib/audit/audit-log.service.js +187 -0
  6. package/lib/audit/redact.d.ts +3 -0
  7. package/lib/audit/redact.js +28 -0
  8. package/lib/catalog/capabilities/blocked-local-actions.d.ts +1 -0
  9. package/lib/catalog/capabilities/blocked-local-actions.js +18 -0
  10. package/lib/catalog/capabilities/frontend-standard.d.ts +2 -0
  11. package/lib/catalog/capabilities/frontend-standard.js +36 -0
  12. package/lib/catalog/capabilities/hub-v2.d.ts +2 -0
  13. package/lib/catalog/capabilities/hub-v2.js +34 -0
  14. package/lib/catalog/capabilities/nginx.d.ts +2 -0
  15. package/lib/catalog/capabilities/nginx.js +23 -0
  16. package/lib/catalog/capabilities/project.d.ts +2 -0
  17. package/lib/catalog/capabilities/project.js +23 -0
  18. package/lib/catalog/capabilities/router.d.ts +2 -0
  19. package/lib/catalog/capabilities/router.js +11 -0
  20. package/lib/catalog/capabilities/runtime.d.ts +2 -0
  21. package/lib/catalog/capabilities/runtime.js +17 -0
  22. package/lib/catalog/capabilities/workspace.d.ts +2 -0
  23. package/lib/catalog/capabilities/workspace.js +23 -0
  24. package/lib/catalog/helpers.d.ts +3 -0
  25. package/lib/catalog/helpers.js +42 -0
  26. package/lib/catalog/index.d.ts +4 -0
  27. package/lib/catalog/index.js +23 -0
  28. package/lib/catalog/tools/frontend-standard.d.ts +2 -0
  29. package/lib/catalog/tools/frontend-standard.js +166 -0
  30. package/lib/catalog/tools/hub-v2-api.d.ts +2 -0
  31. package/lib/catalog/tools/hub-v2-api.js +124 -0
  32. package/lib/catalog/tools/hub-v2-docs.d.ts +2 -0
  33. package/lib/catalog/tools/hub-v2-docs.js +40 -0
  34. package/lib/catalog/tools/nginx.d.ts +2 -0
  35. package/lib/catalog/tools/nginx.js +96 -0
  36. package/lib/catalog/tools/project.d.ts +2 -0
  37. package/lib/catalog/tools/project.js +138 -0
  38. package/lib/catalog/tools/router.d.ts +2 -0
  39. package/lib/catalog/tools/router.js +26 -0
  40. package/lib/catalog/tools/runtime.d.ts +2 -0
  41. package/lib/catalog/tools/runtime.js +47 -0
  42. package/lib/catalog/tools/workspace.d.ts +2 -0
  43. package/lib/catalog/tools/workspace.js +75 -0
  44. package/lib/catalog/types.d.ts +15 -0
  45. package/lib/catalog/types.js +2 -0
  46. package/lib/context/create-tool-context.js +11 -10
  47. package/lib/context/local-server-client.d.ts +2 -0
  48. package/lib/context/local-server-client.js +174 -0
  49. package/lib/context/tool-context.d.ts +36 -0
  50. package/lib/doctor.d.ts +8 -0
  51. package/lib/doctor.js +221 -0
  52. package/lib/errors/error-codes.d.ts +12 -0
  53. package/lib/errors/error-codes.js +14 -0
  54. package/lib/errors/mcp-tool-error.d.ts +8 -0
  55. package/lib/errors/mcp-tool-error.js +14 -0
  56. package/lib/filesystem/project-files.d.ts +18 -0
  57. package/lib/filesystem/project-files.js +112 -0
  58. package/lib/git/local-git-read-service.d.ts +2 -0
  59. package/lib/git/local-git-read-service.js +96 -0
  60. package/lib/index.d.ts +1 -0
  61. package/lib/index.js +4 -0
  62. package/lib/policy/assert-tool-policy.js +10 -1
  63. package/lib/register-tools.js +67 -10
  64. package/lib/registry/tool-names.d.ts +95 -0
  65. package/lib/registry/tool-names.js +97 -0
  66. package/lib/services/path-guard.service.d.ts +4 -0
  67. package/lib/services/path-guard.service.js +75 -0
  68. package/lib/services/permission.service.d.ts +5 -0
  69. package/lib/services/permission.service.js +38 -0
  70. package/lib/services/project-resolver.service.d.ts +32 -0
  71. package/lib/services/project-resolver.service.js +95 -0
  72. package/lib/standard/frontend-standard.default.d.ts +2 -0
  73. package/lib/standard/frontend-standard.default.js +51 -0
  74. package/lib/standard/frontend-standard.schema.d.ts +196 -0
  75. package/lib/standard/frontend-standard.schema.js +61 -0
  76. package/lib/standard/frontend-standard.service.d.ts +79 -0
  77. package/lib/standard/frontend-standard.service.js +115 -0
  78. package/lib/standard/project-scan.d.ts +9 -0
  79. package/lib/standard/project-scan.js +91 -0
  80. package/lib/standard/validators/angular-structure.validator.d.ts +4 -0
  81. package/lib/standard/validators/angular-structure.validator.js +75 -0
  82. package/lib/standard/validators/component.validator.d.ts +4 -0
  83. package/lib/standard/validators/component.validator.js +94 -0
  84. package/lib/standard/validators/git.validator.d.ts +8 -0
  85. package/lib/standard/validators/git.validator.js +32 -0
  86. package/lib/standard/validators/review.validator.d.ts +15 -0
  87. package/lib/standard/validators/review.validator.js +67 -0
  88. package/lib/standard/validators/test.validator.d.ts +19 -0
  89. package/lib/standard/validators/test.validator.js +89 -0
  90. package/lib/tool-catalog.d.ts +2 -0
  91. package/lib/tool-catalog.js +6 -0
  92. package/lib/tools/angular/angular-standard.tools.d.ts +2 -0
  93. package/lib/tools/angular/angular-standard.tools.js +53 -0
  94. package/lib/tools/angular/index.d.ts +1 -0
  95. package/lib/tools/angular/index.js +5 -0
  96. package/lib/tools/capability.tools.d.ts +2 -0
  97. package/lib/tools/capability.tools.js +205 -0
  98. package/lib/tools/controlled/index.d.ts +2 -0
  99. package/lib/tools/controlled/index.js +13 -0
  100. package/lib/tools/controlled/local-server.d.ts +6 -0
  101. package/lib/tools/controlled/local-server.js +17 -0
  102. package/lib/tools/controlled/operation-policy.d.ts +22 -0
  103. package/lib/tools/controlled/operation-policy.js +50 -0
  104. package/lib/tools/controlled/operation-result.d.ts +30 -0
  105. package/lib/tools/controlled/operation-result.js +33 -0
  106. package/lib/tools/controlled/schemas.d.ts +159 -0
  107. package/lib/tools/controlled/schemas.js +49 -0
  108. package/lib/tools/controlled.tools.d.ts +1 -0
  109. package/lib/tools/controlled.tools.js +5 -0
  110. package/lib/tools/file-write.tools.d.ts +2 -0
  111. package/lib/tools/file-write.tools.js +70 -0
  112. package/lib/tools/git.tools.js +109 -8
  113. package/lib/tools/hub-v2/client.d.ts +6 -1
  114. package/lib/tools/hub-v2/client.js +15 -0
  115. package/lib/tools/hub-v2/config/config-paths.d.ts +2 -0
  116. package/lib/tools/hub-v2/config/config-paths.js +17 -0
  117. package/lib/tools/hub-v2/config/env.d.ts +1 -0
  118. package/lib/tools/hub-v2/config/env.js +12 -0
  119. package/lib/tools/hub-v2/config/index.d.ts +8 -0
  120. package/lib/tools/hub-v2/config/index.js +18 -0
  121. package/lib/tools/hub-v2/config/jsonc.d.ts +5 -0
  122. package/lib/tools/hub-v2/config/jsonc.js +86 -0
  123. package/lib/tools/hub-v2/config/load-config.d.ts +18 -0
  124. package/lib/tools/hub-v2/config/load-config.js +93 -0
  125. package/lib/tools/hub-v2/config/project-selector.d.ts +5 -0
  126. package/lib/tools/hub-v2/config/project-selector.js +92 -0
  127. package/lib/tools/hub-v2/config/resolve-context.d.ts +13 -0
  128. package/lib/tools/hub-v2/config/resolve-context.js +33 -0
  129. package/lib/tools/hub-v2/docs.tools.js +138 -4
  130. package/lib/tools/hub-v2/index.js +2 -0
  131. package/lib/tools/hub-v2/issues-workflow.tools.d.ts +2 -0
  132. package/lib/tools/hub-v2/issues-workflow.tools.js +199 -0
  133. package/lib/tools/hub-v2/issues.tools.js +96 -6
  134. package/lib/tools/hub-v2/projects.tools.js +16 -3
  135. package/lib/tools/hub-v2/raw.d.ts +8 -0
  136. package/lib/tools/hub-v2/raw.js +33 -0
  137. package/lib/tools/hub-v2/rd.tools.js +167 -8
  138. package/lib/tools/hub-v2/schemas.d.ts +668 -71
  139. package/lib/tools/hub-v2/schemas.js +152 -1
  140. package/lib/tools/hub-v2/upload.tools.js +53 -5
  141. package/lib/tools/index.d.ts +1 -0
  142. package/lib/tools/index.js +22 -0
  143. package/lib/tools/log.tools.js +33 -6
  144. package/lib/tools/nginx/index.d.ts +1 -0
  145. package/lib/tools/nginx/index.js +5 -0
  146. package/lib/tools/nginx/nginx-control.tools.d.ts +2 -0
  147. package/lib/tools/nginx/nginx-control.tools.js +133 -0
  148. package/lib/tools/nginx/nginx-proxy.d.ts +24 -0
  149. package/lib/tools/nginx/nginx-proxy.js +154 -0
  150. package/lib/tools/nginx.tools.d.ts +2 -0
  151. package/lib/tools/nginx.tools.js +111 -0
  152. package/lib/tools/project/index.d.ts +2 -0
  153. package/lib/tools/project/index.js +7 -0
  154. package/lib/tools/project/launch-status.d.ts +10 -0
  155. package/lib/tools/project/launch-status.js +78 -0
  156. package/lib/tools/project/local-diagnostics.d.ts +19 -0
  157. package/lib/tools/project/local-diagnostics.js +97 -0
  158. package/lib/tools/project/observe-redaction.d.ts +3 -0
  159. package/lib/tools/project/observe-redaction.js +25 -0
  160. package/lib/tools/project/observe-runtime.d.ts +72 -0
  161. package/lib/tools/project/observe-runtime.js +147 -0
  162. package/lib/tools/project/project-control.tools.d.ts +2 -0
  163. package/lib/tools/project/project-control.tools.js +216 -0
  164. package/lib/tools/project/project-observe.tools.d.ts +2 -0
  165. package/lib/tools/project/project-observe.tools.js +191 -0
  166. package/lib/tools/project/runtime-config.d.ts +7 -0
  167. package/lib/tools/project/runtime-config.js +50 -0
  168. package/lib/tools/project-observe.tools.d.ts +1 -0
  169. package/lib/tools/project-observe.tools.js +5 -0
  170. package/lib/tools/project.tools.d.ts +8 -0
  171. package/lib/tools/project.tools.js +97 -6
  172. package/lib/tools/proxy.tools.js +4 -4
  173. package/lib/tools/review/index.d.ts +1 -0
  174. package/lib/tools/review/index.js +5 -0
  175. package/lib/tools/review/review.tools.d.ts +2 -0
  176. package/lib/tools/review/review.tools.js +152 -0
  177. package/lib/tools/runtime/index.d.ts +1 -0
  178. package/lib/tools/runtime/index.js +5 -0
  179. package/lib/tools/runtime/runtime-control.tools.d.ts +2 -0
  180. package/lib/tools/runtime/runtime-control.tools.js +89 -0
  181. package/lib/tools/runtime.tools.js +41 -4
  182. package/lib/tools/standard/index.d.ts +1 -0
  183. package/lib/tools/standard/index.js +5 -0
  184. package/lib/tools/standard/standard.tools.d.ts +2 -0
  185. package/lib/tools/standard/standard.tools.js +91 -0
  186. package/lib/tools/task.tools.js +44 -9
  187. package/lib/tools/test/index.d.ts +1 -0
  188. package/lib/tools/test/index.js +5 -0
  189. package/lib/tools/test/test-standard.tools.d.ts +2 -0
  190. package/lib/tools/test/test-standard.tools.js +51 -0
  191. package/lib/tools/tool-catalog.d.ts +2 -0
  192. package/lib/tools/tool-catalog.js +7 -0
  193. package/lib/tools/workflow/frontend-workflow.tools.d.ts +2 -0
  194. package/lib/tools/workflow/frontend-workflow.tools.js +364 -0
  195. package/lib/tools/workflow/index.d.ts +1 -0
  196. package/lib/tools/workflow/index.js +5 -0
  197. package/lib/tools/workspace-package.d.ts +22 -0
  198. package/lib/tools/workspace-package.js +130 -0
  199. package/lib/tools/workspace.tools.d.ts +7 -0
  200. package/lib/tools/workspace.tools.js +336 -0
  201. package/lib/utils/errors.js +6 -1
  202. package/lib/utils/result.d.ts +9 -0
  203. package/lib/utils/result.js +9 -0
  204. package/lib/workflow/frontend-task.schema.d.ts +83 -0
  205. package/lib/workflow/frontend-task.schema.js +25 -0
  206. package/lib/workflow/frontend-task.service.d.ts +57 -0
  207. package/lib/workflow/frontend-task.service.js +195 -0
  208. package/lib/workflow/workflow-status.d.ts +2 -0
  209. package/lib/workflow/workflow-status.js +14 -0
  210. package/lib/workflow/workflow-transition.d.ts +9 -0
  211. package/lib/workflow/workflow-transition.js +38 -0
  212. package/package.json +5 -3
  213. package/lib/tools/hub-v2/config.d.ts +0 -34
  214. package/lib/tools/hub-v2/config.js +0 -297
@@ -0,0 +1,196 @@
1
+ import { z } from "zod";
2
+ export declare const frontendStandardSchema: z.ZodObject<{
3
+ framework: z.ZodObject<{
4
+ name: z.ZodString;
5
+ version: z.ZodOptional<z.ZodString>;
6
+ }, "strict", z.ZodTypeAny, {
7
+ name: string;
8
+ version?: string | undefined;
9
+ }, {
10
+ name: string;
11
+ version?: string | undefined;
12
+ }>;
13
+ uiLibrary: z.ZodObject<{
14
+ name: z.ZodString;
15
+ componentPrefix: z.ZodOptional<z.ZodString>;
16
+ }, "strict", z.ZodTypeAny, {
17
+ name: string;
18
+ componentPrefix?: string | undefined;
19
+ }, {
20
+ name: string;
21
+ componentPrefix?: string | undefined;
22
+ }>;
23
+ style: z.ZodObject<{
24
+ language: z.ZodString;
25
+ fileExtension: z.ZodString;
26
+ }, "strict", z.ZodTypeAny, {
27
+ language: string;
28
+ fileExtension: string;
29
+ }, {
30
+ language: string;
31
+ fileExtension: string;
32
+ }>;
33
+ naming: z.ZodObject<{
34
+ branchPatterns: z.ZodArray<z.ZodString, "many">;
35
+ commitTypes: z.ZodArray<z.ZodString, "many">;
36
+ componentSuffixes: z.ZodArray<z.ZodString, "many">;
37
+ }, "strict", z.ZodTypeAny, {
38
+ branchPatterns: string[];
39
+ commitTypes: string[];
40
+ componentSuffixes: string[];
41
+ }, {
42
+ branchPatterns: string[];
43
+ commitTypes: string[];
44
+ componentSuffixes: string[];
45
+ }>;
46
+ structure: z.ZodObject<{
47
+ pagesDir: z.ZodString;
48
+ componentsDir: z.ZodString;
49
+ servicesDir: z.ZodString;
50
+ modelsDir: z.ZodString;
51
+ maxComponentFileLines: z.ZodNumber;
52
+ }, "strict", z.ZodTypeAny, {
53
+ pagesDir: string;
54
+ componentsDir: string;
55
+ servicesDir: string;
56
+ modelsDir: string;
57
+ maxComponentFileLines: number;
58
+ }, {
59
+ pagesDir: string;
60
+ componentsDir: string;
61
+ servicesDir: string;
62
+ modelsDir: string;
63
+ maxComponentFileLines: number;
64
+ }>;
65
+ git: z.ZodObject<{
66
+ branchPatterns: z.ZodArray<z.ZodString, "many">;
67
+ commitPattern: z.ZodString;
68
+ }, "strict", z.ZodTypeAny, {
69
+ branchPatterns: string[];
70
+ commitPattern: string;
71
+ }, {
72
+ branchPatterns: string[];
73
+ commitPattern: string;
74
+ }>;
75
+ testing: z.ZodObject<{
76
+ requireServiceSpec: z.ZodBoolean;
77
+ requireUtilSpec: z.ZodBoolean;
78
+ suggestComponentSpec: z.ZodBoolean;
79
+ }, "strict", z.ZodTypeAny, {
80
+ requireServiceSpec: boolean;
81
+ requireUtilSpec: boolean;
82
+ suggestComponentSpec: boolean;
83
+ }, {
84
+ requireServiceSpec: boolean;
85
+ requireUtilSpec: boolean;
86
+ suggestComponentSpec: boolean;
87
+ }>;
88
+ review: z.ZodObject<{
89
+ requireChecklist: z.ZodBoolean;
90
+ riskKeywords: z.ZodArray<z.ZodString, "many">;
91
+ }, "strict", z.ZodTypeAny, {
92
+ requireChecklist: boolean;
93
+ riskKeywords: string[];
94
+ }, {
95
+ requireChecklist: boolean;
96
+ riskKeywords: string[];
97
+ }>;
98
+ }, "strict", z.ZodTypeAny, {
99
+ review: {
100
+ requireChecklist: boolean;
101
+ riskKeywords: string[];
102
+ };
103
+ framework: {
104
+ name: string;
105
+ version?: string | undefined;
106
+ };
107
+ uiLibrary: {
108
+ name: string;
109
+ componentPrefix?: string | undefined;
110
+ };
111
+ style: {
112
+ language: string;
113
+ fileExtension: string;
114
+ };
115
+ naming: {
116
+ branchPatterns: string[];
117
+ commitTypes: string[];
118
+ componentSuffixes: string[];
119
+ };
120
+ structure: {
121
+ pagesDir: string;
122
+ componentsDir: string;
123
+ servicesDir: string;
124
+ modelsDir: string;
125
+ maxComponentFileLines: number;
126
+ };
127
+ git: {
128
+ branchPatterns: string[];
129
+ commitPattern: string;
130
+ };
131
+ testing: {
132
+ requireServiceSpec: boolean;
133
+ requireUtilSpec: boolean;
134
+ suggestComponentSpec: boolean;
135
+ };
136
+ }, {
137
+ review: {
138
+ requireChecklist: boolean;
139
+ riskKeywords: string[];
140
+ };
141
+ framework: {
142
+ name: string;
143
+ version?: string | undefined;
144
+ };
145
+ uiLibrary: {
146
+ name: string;
147
+ componentPrefix?: string | undefined;
148
+ };
149
+ style: {
150
+ language: string;
151
+ fileExtension: string;
152
+ };
153
+ naming: {
154
+ branchPatterns: string[];
155
+ commitTypes: string[];
156
+ componentSuffixes: string[];
157
+ };
158
+ structure: {
159
+ pagesDir: string;
160
+ componentsDir: string;
161
+ servicesDir: string;
162
+ modelsDir: string;
163
+ maxComponentFileLines: number;
164
+ };
165
+ git: {
166
+ branchPatterns: string[];
167
+ commitPattern: string;
168
+ };
169
+ testing: {
170
+ requireServiceSpec: boolean;
171
+ requireUtilSpec: boolean;
172
+ suggestComponentSpec: boolean;
173
+ };
174
+ }>;
175
+ export type FrontendStandard = z.infer<typeof frontendStandardSchema>;
176
+ export type FindingSeverity = "info" | "warning" | "error";
177
+ export type CheckStatus = "passed" | "warning" | "failed" | "blocked";
178
+ export type StandardFinding = {
179
+ ruleId: string;
180
+ severity: FindingSeverity;
181
+ message: string;
182
+ file?: string;
183
+ line?: number;
184
+ suggestion?: string;
185
+ };
186
+ export type StandardCheckResult = {
187
+ status: CheckStatus;
188
+ findings: StandardFinding[];
189
+ summary: {
190
+ passed: number;
191
+ warnings: number;
192
+ errors: number;
193
+ nextSteps: string[];
194
+ };
195
+ };
196
+ export declare function summarizeFindings(findings: StandardFinding[]): StandardCheckResult;
@@ -0,0 +1,61 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.frontendStandardSchema = void 0;
4
+ exports.summarizeFindings = summarizeFindings;
5
+ const zod_1 = require("zod");
6
+ exports.frontendStandardSchema = zod_1.z.object({
7
+ framework: zod_1.z.object({
8
+ name: zod_1.z.string().min(1),
9
+ version: zod_1.z.string().optional(),
10
+ }).strict(),
11
+ uiLibrary: zod_1.z.object({
12
+ name: zod_1.z.string().min(1),
13
+ componentPrefix: zod_1.z.string().optional(),
14
+ }).strict(),
15
+ style: zod_1.z.object({
16
+ language: zod_1.z.string().min(1),
17
+ fileExtension: zod_1.z.string().min(1),
18
+ }).strict(),
19
+ naming: zod_1.z.object({
20
+ branchPatterns: zod_1.z.array(zod_1.z.string()).min(1),
21
+ commitTypes: zod_1.z.array(zod_1.z.string()).min(1),
22
+ componentSuffixes: zod_1.z.array(zod_1.z.string()).min(1),
23
+ }).strict(),
24
+ structure: zod_1.z.object({
25
+ pagesDir: zod_1.z.string().min(1),
26
+ componentsDir: zod_1.z.string().min(1),
27
+ servicesDir: zod_1.z.string().min(1),
28
+ modelsDir: zod_1.z.string().min(1),
29
+ maxComponentFileLines: zod_1.z.number().int().min(50).max(2000),
30
+ }).strict(),
31
+ git: zod_1.z.object({
32
+ branchPatterns: zod_1.z.array(zod_1.z.string()).min(1),
33
+ commitPattern: zod_1.z.string().min(1),
34
+ }).strict(),
35
+ testing: zod_1.z.object({
36
+ requireServiceSpec: zod_1.z.boolean(),
37
+ requireUtilSpec: zod_1.z.boolean(),
38
+ suggestComponentSpec: zod_1.z.boolean(),
39
+ }).strict(),
40
+ review: zod_1.z.object({
41
+ requireChecklist: zod_1.z.boolean(),
42
+ riskKeywords: zod_1.z.array(zod_1.z.string()),
43
+ }).strict(),
44
+ }).strict();
45
+ function summarizeFindings(findings) {
46
+ const errors = findings.filter((item) => item.severity === "error").length;
47
+ const warnings = findings.filter((item) => item.severity === "warning").length;
48
+ const status = errors > 0 ? "failed" : warnings > 0 ? "warning" : "passed";
49
+ return {
50
+ status,
51
+ findings,
52
+ summary: {
53
+ passed: findings.length === 0 ? 1 : 0,
54
+ warnings,
55
+ errors,
56
+ nextSteps: findings.length === 0
57
+ ? ["No action required."]
58
+ : findings.slice(0, 5).map((item) => item.suggestion ?? item.message),
59
+ },
60
+ };
61
+ }
@@ -0,0 +1,79 @@
1
+ import { type FrontendStandard, type StandardFinding } from "./frontend-standard.schema";
2
+ import { type ResolvedProjectRoot } from "../filesystem/project-files";
3
+ import { type SourceFile } from "./project-scan";
4
+ export type LoadedFrontendStandard = {
5
+ source: "file" | "default";
6
+ path: string;
7
+ standard: FrontendStandard;
8
+ };
9
+ export declare function standardConfigPath(projectRoot: string): string;
10
+ export declare function loadFrontendStandard(project: ResolvedProjectRoot): Promise<LoadedFrontendStandard>;
11
+ export declare function initFrontendStandard(project: ResolvedProjectRoot, overwrite?: boolean): Promise<{
12
+ status: string;
13
+ path: string;
14
+ reason: string;
15
+ changedFiles?: undefined;
16
+ standard?: undefined;
17
+ } | {
18
+ status: string;
19
+ path: string;
20
+ changedFiles: string[];
21
+ standard: {
22
+ review: {
23
+ requireChecklist: boolean;
24
+ riskKeywords: string[];
25
+ };
26
+ framework: {
27
+ name: string;
28
+ version?: string | undefined;
29
+ };
30
+ uiLibrary: {
31
+ name: string;
32
+ componentPrefix?: string | undefined;
33
+ };
34
+ style: {
35
+ language: string;
36
+ fileExtension: string;
37
+ };
38
+ naming: {
39
+ branchPatterns: string[];
40
+ commitTypes: string[];
41
+ componentSuffixes: string[];
42
+ };
43
+ structure: {
44
+ pagesDir: string;
45
+ componentsDir: string;
46
+ servicesDir: string;
47
+ modelsDir: string;
48
+ maxComponentFileLines: number;
49
+ };
50
+ git: {
51
+ branchPatterns: string[];
52
+ commitPattern: string;
53
+ };
54
+ testing: {
55
+ requireServiceSpec: boolean;
56
+ requireUtilSpec: boolean;
57
+ suggestComponentSpec: boolean;
58
+ };
59
+ };
60
+ reason?: undefined;
61
+ }>;
62
+ export declare function scanFrontendProject(projectRoot: string): Promise<SourceFile[]>;
63
+ export declare function validateFrontendProject(project: ResolvedProjectRoot, standard: FrontendStandard): Promise<{
64
+ checks: {
65
+ structure: import("./frontend-standard.schema").StandardCheckResult;
66
+ componentNaming: import("./frontend-standard.schema").StandardCheckResult;
67
+ componentBoundary: import("./frontend-standard.schema").StandardCheckResult;
68
+ missingSpecs: import("./frontend-standard.schema").StandardCheckResult;
69
+ testNaming: import("./frontend-standard.schema").StandardCheckResult;
70
+ };
71
+ status: import("./frontend-standard.schema").CheckStatus;
72
+ findings: StandardFinding[];
73
+ summary: {
74
+ passed: number;
75
+ warnings: number;
76
+ errors: number;
77
+ nextSteps: string[];
78
+ };
79
+ }>;
@@ -0,0 +1,115 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.standardConfigPath = standardConfigPath;
37
+ exports.loadFrontendStandard = loadFrontendStandard;
38
+ exports.initFrontendStandard = initFrontendStandard;
39
+ exports.scanFrontendProject = scanFrontendProject;
40
+ exports.validateFrontendProject = validateFrontendProject;
41
+ const fs = __importStar(require("fs/promises"));
42
+ const frontend_standard_default_1 = require("./frontend-standard.default");
43
+ const frontend_standard_schema_1 = require("./frontend-standard.schema");
44
+ const project_files_1 = require("../filesystem/project-files");
45
+ const project_scan_1 = require("./project-scan");
46
+ const angular_structure_validator_1 = require("./validators/angular-structure.validator");
47
+ const component_validator_1 = require("./validators/component.validator");
48
+ const test_validator_1 = require("./validators/test.validator");
49
+ function standardConfigPath(projectRoot) {
50
+ return (0, project_files_1.resolveNgManagerPath)(projectRoot, "frontend-standard.json");
51
+ }
52
+ async function loadFrontendStandard(project) {
53
+ const filePath = standardConfigPath(project.projectRoot);
54
+ try {
55
+ const raw = await fs.readFile(filePath, "utf-8");
56
+ return {
57
+ source: "file",
58
+ path: filePath,
59
+ standard: frontend_standard_schema_1.frontendStandardSchema.parse(JSON.parse(raw)),
60
+ };
61
+ }
62
+ catch (error) {
63
+ if (error.code !== "ENOENT") {
64
+ throw error;
65
+ }
66
+ return {
67
+ source: "default",
68
+ path: filePath,
69
+ standard: frontend_standard_default_1.defaultFrontendStandard,
70
+ };
71
+ }
72
+ }
73
+ async function initFrontendStandard(project, overwrite = false) {
74
+ const filePath = standardConfigPath(project.projectRoot);
75
+ const exists = await (0, project_files_1.pathExists)(filePath);
76
+ if (exists && !overwrite) {
77
+ return {
78
+ status: "blocked",
79
+ path: filePath,
80
+ reason: "frontend-standard.json already exists; pass overwrite=true to replace it",
81
+ };
82
+ }
83
+ await (0, project_files_1.writeJsonFile)(filePath, frontend_standard_default_1.defaultFrontendStandard);
84
+ return {
85
+ status: "executed",
86
+ path: filePath,
87
+ changedFiles: [".ng-manager/frontend-standard.json"],
88
+ standard: frontend_standard_default_1.defaultFrontendStandard,
89
+ };
90
+ }
91
+ async function scanFrontendProject(projectRoot) {
92
+ const files = await (0, project_scan_1.listProjectFiles)(projectRoot);
93
+ return (0, project_scan_1.readSourceFiles)(files, (file) => file.path.endsWith(".ts") || file.path.endsWith("package.json"));
94
+ }
95
+ function mergeFindings(groups) {
96
+ return (0, frontend_standard_schema_1.summarizeFindings)(groups.flat());
97
+ }
98
+ async function validateFrontendProject(project, standard) {
99
+ const files = await scanFrontendProject(project.projectRoot);
100
+ const structure = (0, angular_structure_validator_1.validateAngularStructure)(files, standard);
101
+ const naming = (0, component_validator_1.validateComponentNaming)(files, standard);
102
+ const boundary = (0, component_validator_1.validateComponentBoundary)(files, standard);
103
+ const test = (0, test_validator_1.detectMissingSpecs)(files, standard);
104
+ const testNaming = (0, test_validator_1.validateSpecNaming)(files);
105
+ return {
106
+ ...mergeFindings([structure.findings, naming.findings, boundary.findings, test.findings, testNaming.findings]),
107
+ checks: {
108
+ structure,
109
+ componentNaming: naming,
110
+ componentBoundary: boundary,
111
+ missingSpecs: test,
112
+ testNaming,
113
+ },
114
+ };
115
+ }
@@ -0,0 +1,9 @@
1
+ export type SourceFile = {
2
+ path: string;
3
+ absolutePath: string;
4
+ text?: string;
5
+ lineCount?: number;
6
+ };
7
+ export declare function listProjectFiles(projectRoot: string, maxFiles?: number): Promise<SourceFile[]>;
8
+ export declare function readSourceText(file: SourceFile, maxBytes?: number): Promise<SourceFile>;
9
+ export declare function readSourceFiles(files: SourceFile[], predicate: (file: SourceFile) => boolean): Promise<SourceFile[]>;
@@ -0,0 +1,91 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.listProjectFiles = listProjectFiles;
37
+ exports.readSourceText = readSourceText;
38
+ exports.readSourceFiles = readSourceFiles;
39
+ const fs = __importStar(require("fs/promises"));
40
+ const path = __importStar(require("path"));
41
+ const project_files_1 = require("../filesystem/project-files");
42
+ const IGNORED_DIRS = new Set([".git", ".ng-manager", "node_modules", "dist", "lib", "coverage", ".angular", ".cache"]);
43
+ async function listProjectFiles(projectRoot, maxFiles = 12000) {
44
+ const out = [];
45
+ async function visit(dir) {
46
+ if (out.length >= maxFiles)
47
+ return;
48
+ let entries;
49
+ try {
50
+ entries = await fs.readdir(dir, { withFileTypes: true });
51
+ }
52
+ catch {
53
+ return;
54
+ }
55
+ for (const entry of entries) {
56
+ if (out.length >= maxFiles)
57
+ return;
58
+ if (entry.isDirectory()) {
59
+ if (!IGNORED_DIRS.has(entry.name)) {
60
+ await visit(path.join(dir, entry.name));
61
+ }
62
+ continue;
63
+ }
64
+ if (!entry.isFile())
65
+ continue;
66
+ const absolutePath = path.join(dir, entry.name);
67
+ out.push({
68
+ path: (0, project_files_1.projectRelativePath)(projectRoot, absolutePath),
69
+ absolutePath,
70
+ });
71
+ }
72
+ }
73
+ await visit(projectRoot);
74
+ return out.sort((a, b) => a.path.localeCompare(b.path));
75
+ }
76
+ async function readSourceText(file, maxBytes = 250000) {
77
+ const stat = await fs.stat(file.absolutePath);
78
+ if (stat.size > maxBytes) {
79
+ return { ...file, text: "", lineCount: undefined };
80
+ }
81
+ const text = await fs.readFile(file.absolutePath, "utf-8");
82
+ return {
83
+ ...file,
84
+ text,
85
+ lineCount: text.split(/\r?\n/).length,
86
+ };
87
+ }
88
+ async function readSourceFiles(files, predicate) {
89
+ const selected = files.filter(predicate);
90
+ return Promise.all(selected.map((file) => readSourceText(file).catch(() => file)));
91
+ }
@@ -0,0 +1,4 @@
1
+ import type { FrontendStandard, StandardFinding } from "../frontend-standard.schema";
2
+ import type { SourceFile } from "../project-scan";
3
+ export declare function validateAngularStructure(files: SourceFile[], standard: FrontendStandard): import("../frontend-standard.schema").StandardCheckResult;
4
+ export declare function validatePagePlacement(files: SourceFile[], standard: FrontendStandard): StandardFinding[];
@@ -0,0 +1,75 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.validateAngularStructure = validateAngularStructure;
37
+ exports.validatePagePlacement = validatePagePlacement;
38
+ const path = __importStar(require("path"));
39
+ const frontend_standard_schema_1 = require("../frontend-standard.schema");
40
+ function hasDirectory(files, dir) {
41
+ const normalized = dir.replace(/\\/g, "/").replace(/\/$/, "");
42
+ return files.some((file) => file.path === normalized || file.path.startsWith(`${normalized}/`));
43
+ }
44
+ function validateAngularStructure(files, standard) {
45
+ const findings = [];
46
+ for (const [key, dir] of Object.entries({
47
+ pages: standard.structure.pagesDir,
48
+ components: standard.structure.componentsDir,
49
+ services: standard.structure.servicesDir,
50
+ models: standard.structure.modelsDir,
51
+ })) {
52
+ if (!hasDirectory(files, dir)) {
53
+ findings.push({
54
+ ruleId: `angular.structure.${key}`,
55
+ severity: "warning",
56
+ message: `Expected Angular ${key} directory was not found: ${dir}`,
57
+ suggestion: `Create ${dir} when this project owns Angular ${key} code, or update frontend-standard.json for this project.`,
58
+ });
59
+ }
60
+ }
61
+ return (0, frontend_standard_schema_1.summarizeFindings)(findings);
62
+ }
63
+ function validatePagePlacement(files, standard) {
64
+ const pagesDir = standard.structure.pagesDir.replace(/\\/g, "/").replace(/\/$/, "");
65
+ return files
66
+ .filter((file) => file.path.endsWith(".page.ts") || path.basename(file.path).includes("-page.component."))
67
+ .filter((file) => !file.path.startsWith(`${pagesDir}/`))
68
+ .map((file) => ({
69
+ ruleId: "angular.page-placement",
70
+ severity: "warning",
71
+ message: `Page component is outside ${pagesDir}.`,
72
+ file: file.path,
73
+ suggestion: "Move route/page-level components under the configured pages directory.",
74
+ }));
75
+ }
@@ -0,0 +1,4 @@
1
+ import type { FrontendStandard } from "../frontend-standard.schema";
2
+ import type { SourceFile } from "../project-scan";
3
+ export declare function validateComponentNaming(files: SourceFile[], standard: FrontendStandard): import("../frontend-standard.schema").StandardCheckResult;
4
+ export declare function validateComponentBoundary(files: SourceFile[], standard: FrontendStandard): import("../frontend-standard.schema").StandardCheckResult;