@manojkmfsi/monodog 1.1.6 → 1.1.8

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 (53) hide show
  1. package/.turbo/turbo-build.log +1 -1
  2. package/CHANGELOG.md +12 -0
  3. package/package.json +1 -1
  4. package/src/config/swagger-config.ts +0 -344
  5. package/src/config-loader.ts +0 -97
  6. package/src/constants/index.ts +0 -13
  7. package/src/constants/middleware.ts +0 -83
  8. package/src/constants/port.ts +0 -20
  9. package/src/constants/security.ts +0 -78
  10. package/src/controllers/commit-controller.ts +0 -31
  11. package/src/controllers/config-controller.ts +0 -42
  12. package/src/controllers/health-controller.ts +0 -24
  13. package/src/controllers/package-controller.ts +0 -67
  14. package/src/get-db-url.ts +0 -9
  15. package/src/index.ts +0 -9
  16. package/src/middleware/dashboard-startup.ts +0 -161
  17. package/src/middleware/error-handler.ts +0 -50
  18. package/src/middleware/index.ts +0 -20
  19. package/src/middleware/logger.ts +0 -65
  20. package/src/middleware/security.ts +0 -90
  21. package/src/middleware/server-startup.ts +0 -153
  22. package/src/middleware/swagger-middleware.ts +0 -58
  23. package/src/repositories/commit-repository.ts +0 -108
  24. package/src/repositories/dependency-repository.ts +0 -110
  25. package/src/repositories/index.ts +0 -10
  26. package/src/repositories/package-health-repository.ts +0 -75
  27. package/src/repositories/package-repository.ts +0 -142
  28. package/src/repositories/prisma-client.ts +0 -25
  29. package/src/routes/commit-routes.ts +0 -10
  30. package/src/routes/config-routes.ts +0 -14
  31. package/src/routes/health-routes.ts +0 -14
  32. package/src/routes/package-routes.ts +0 -22
  33. package/src/serve.ts +0 -41
  34. package/src/services/commit-service.ts +0 -44
  35. package/src/services/config-service.ts +0 -391
  36. package/src/services/git-service.ts +0 -140
  37. package/src/services/health-service.ts +0 -162
  38. package/src/services/package-service.ts +0 -228
  39. package/src/setup.ts +0 -78
  40. package/src/types/ci.ts +0 -122
  41. package/src/types/config.ts +0 -22
  42. package/src/types/database.ts +0 -67
  43. package/src/types/git.ts +0 -33
  44. package/src/types/health.ts +0 -11
  45. package/src/types/index.ts +0 -23
  46. package/src/types/package.ts +0 -39
  47. package/src/types/scanner.ts +0 -31
  48. package/src/types/swagger-jsdoc.d.ts +0 -15
  49. package/src/utils/ci-status.ts +0 -535
  50. package/src/utils/db-utils.ts +0 -92
  51. package/src/utils/health-utils.ts +0 -67
  52. package/src/utils/monorepo-scanner.ts +0 -576
  53. package/src/utils/utilities.ts +0 -427
@@ -1,4 +1,4 @@
1
1
 
2
- > @manojkmfsi/monodog@1.1.6 build /home/runner/work/monodog/monodog/packages/monoapp
2
+ > @manojkmfsi/monodog@1.1.8 build /home/runner/work/monodog/monodog/packages/monoapp
3
3
  > rm -rf dist && tsc
4
4
 
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @manojkmfsi/monoapp
2
2
 
3
+ ## 1.1.8
4
+
5
+ ### Patch Changes
6
+
7
+ - remove src from package
8
+
9
+ ## 1.1.7
10
+
11
+ ### Patch Changes
12
+
13
+ - hide maintainers
14
+
3
15
  ## 1.1.6
4
16
 
5
17
  ### Patch Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@manojkmfsi/monodog",
3
- "version": "1.1.6",
3
+ "version": "1.1.8",
4
4
  "description": "App for monodog monorepo",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -1,344 +0,0 @@
1
- /**
2
- * Swagger API Documentation Configuration
3
- * Defines OpenAPI specification for MonoDog API
4
- */
5
- import { appConfig } from "../config-loader";
6
- export const swaggerDefinition = {
7
- openapi: '3.0.0',
8
- info: {
9
- title: 'MonoDog API',
10
- version: '1.0.0',
11
- description: 'Monorepo Analytics and Health Dashboard API',
12
- contact: {
13
- name: 'MonoDog Team',
14
- url: 'https://github.com/mindfiredigital/monodog',
15
- },
16
- license: {
17
- name: 'MIT',
18
- url: 'https://opensource.org/licenses/MIT',
19
- },
20
- },
21
- servers: [
22
- {
23
- url: `http://${appConfig.server.host}:${appConfig.server.port}/api`,
24
- description: 'Development server',
25
- },
26
-
27
- ],
28
- paths: {
29
- '/packages': {
30
- get: {
31
- tags: ['Packages'],
32
- summary: 'Get all packages',
33
- operationId: 'getPackages',
34
- responses: {
35
- '200': {
36
- description: 'List of packages',
37
- content: {
38
- 'application/json': {
39
- schema: { type: 'array', items: { $ref: '#/components/schemas/Package' } },
40
- },
41
- },
42
- },
43
- '500': { description: 'Internal server error' },
44
- },
45
- },
46
- },
47
- '/packages/{name}': {
48
- get: {
49
- tags: ['Packages'],
50
- summary: 'Get package by name',
51
- operationId: 'getPackageByName',
52
- parameters: [{ name: 'name', in: 'path', required: true, schema: { type: 'string' } }],
53
- responses: {
54
- '200': {
55
- description: 'Package details',
56
- content: {
57
- 'application/json': {
58
- schema: { $ref: '#/components/schemas/Package' },
59
- },
60
- },
61
- },
62
- '404': { description: 'Package not found' },
63
- },
64
- },
65
- },
66
- '/packages/refresh': {
67
- post: {
68
- tags: ['Packages'],
69
- summary: 'Refresh packages',
70
- operationId: 'refreshPackages',
71
- responses: {
72
- '200': { description: 'Packages refreshed successfully' },
73
- },
74
- },
75
- },
76
- '/packages/update-config': {
77
- put: {
78
- tags: ['Packages'],
79
- summary: 'Update package configuration',
80
- operationId: 'updatePackageConfig',
81
- requestBody: {
82
- required: true,
83
- content: {
84
- 'application/json': {
85
- schema: { $ref: '#/components/schemas/Package' },
86
- },
87
- },
88
- },
89
- responses: {
90
- '200': { description: 'Package configuration updated successfully' },
91
- '400': { description: 'Invalid request' },
92
- '404': { description: 'Package not found' },
93
- },
94
- },
95
- },
96
- '/health/packages': {
97
- get: {
98
- tags: ['Health'],
99
- summary: 'Get packages health status',
100
- operationId: 'getPackagesHealth',
101
- responses: {
102
- '200': {
103
- description: 'Health status of all packages',
104
- content: {
105
- 'application/json': {
106
- schema: { type: 'array', items: { $ref: '#/components/schemas/PackageHealth' } },
107
- },
108
- },
109
- },
110
- },
111
- },
112
- },
113
- '/health/refresh': {
114
- post: {
115
- tags: ['Health'],
116
- summary: 'Refresh health status',
117
- operationId: 'refreshHealth',
118
- responses: {
119
- '200': { description: 'Health status refreshed successfully' },
120
- },
121
- },
122
- },
123
- '/commits/{packagePath}': {
124
- get: {
125
- tags: ['Commits'],
126
- summary: 'Get commits for a package',
127
- operationId: 'getCommits',
128
- parameters: [{ name: 'packagePath', in: 'path', required: true, schema: { type: 'string' } }],
129
- responses: {
130
- '200': {
131
- description: 'List of commits',
132
- content: {
133
- 'application/json': {
134
- schema: { type: 'array', items: { $ref: '#/components/schemas/Commit' } },
135
- },
136
- },
137
- },
138
- },
139
- },
140
- },
141
- '/config/files': {
142
- get: {
143
- tags: ['Configuration'],
144
- summary: 'Get configuration files',
145
- operationId: 'getConfigFiles',
146
- responses: {
147
- '200': {
148
- description: 'List of configuration files',
149
- content: {
150
- 'application/json': {
151
- schema: { type: 'array', items: { $ref: '#/components/schemas/ConfigFile' } },
152
- },
153
- },
154
- },
155
- },
156
- },
157
- },
158
- '/config/files/{id}': {
159
- put: {
160
- tags: ['Configuration'],
161
- summary: 'Update configuration file',
162
- operationId: 'updateConfigFile',
163
- parameters: [{ name: 'id', in: 'path', required: true, schema: { type: 'string' } }],
164
- requestBody: {
165
- required: true,
166
- content: {
167
- 'application/json': {
168
- schema: { $ref: '#/components/schemas/ConfigFile' },
169
- },
170
- },
171
- },
172
- responses: {
173
- '200': { description: 'Configuration file updated successfully' },
174
- '400': { description: 'Invalid request' },
175
- '404': { description: 'Configuration file not found' },
176
- },
177
- },
178
- },
179
- },
180
- tags: [
181
- {
182
- name: 'Packages',
183
- description: 'Package management and analysis endpoints',
184
- },
185
- {
186
- name: 'Health',
187
- description: 'Health monitoring and status endpoints',
188
- },
189
- {
190
- name: 'Commits',
191
- description: 'Git commit history and analysis endpoints',
192
- },
193
- {
194
- name: 'Configuration',
195
- description: 'Configuration file management endpoints',
196
- },
197
- ],
198
- components: {
199
- schemas: {
200
- Package: {
201
- type: 'object',
202
- properties: {
203
- name: {
204
- type: 'string',
205
- description: 'Package name',
206
- },
207
- path: {
208
- type: 'string',
209
- description: 'Package path in monorepo',
210
- },
211
- version: {
212
- type: 'string',
213
- description: 'Package version',
214
- },
215
- size: {
216
- type: 'number',
217
- description: 'Package size in bytes',
218
- },
219
- dependencies: {
220
- type: 'array',
221
- items: {
222
- type: 'string',
223
- },
224
- description: 'List of package dependencies',
225
- },
226
- },
227
- },
228
- PackageHealth: {
229
- type: 'object',
230
- properties: {
231
- packageName: {
232
- type: 'string',
233
- description: 'Name of the package',
234
- },
235
- healthScore: {
236
- type: 'number',
237
- description: 'Health score (0-100)',
238
- minimum: 0,
239
- maximum: 100,
240
- },
241
- lintStatus: {
242
- type: 'string',
243
- enum: ['pass', 'warning', 'fail'],
244
- description: 'Linting status',
245
- },
246
- buildStatus: {
247
- type: 'string',
248
- enum: ['success', 'failed', 'pending'],
249
- description: 'Build status',
250
- },
251
- securityStatus: {
252
- type: 'string',
253
- enum: ['secure', 'warning', 'vulnerable'],
254
- description: 'Security status',
255
- },
256
- testCoverage: {
257
- type: 'number',
258
- description: 'Test coverage percentage',
259
- },
260
- },
261
- },
262
- Commit: {
263
- type: 'object',
264
- properties: {
265
- hash: {
266
- type: 'string',
267
- description: 'Commit hash',
268
- },
269
- author: {
270
- type: 'string',
271
- description: 'Commit author',
272
- },
273
- message: {
274
- type: 'string',
275
- description: 'Commit message',
276
- },
277
- date: {
278
- type: 'string',
279
- format: 'date-time',
280
- description: 'Commit date',
281
- },
282
- filesChanged: {
283
- type: 'number',
284
- description: 'Number of files changed',
285
- },
286
- },
287
- },
288
- ConfigFile: {
289
- type: 'object',
290
- properties: {
291
- id: {
292
- type: 'string',
293
- description: 'Configuration file ID',
294
- },
295
- name: {
296
- type: 'string',
297
- description: 'Configuration file name',
298
- },
299
- path: {
300
- type: 'string',
301
- description: 'Configuration file path',
302
- },
303
- content: {
304
- type: 'string',
305
- description: 'Configuration file content',
306
- },
307
- },
308
- },
309
- Error: {
310
- type: 'object',
311
- properties: {
312
- error: {
313
- type: 'string',
314
- description: 'Error message',
315
- },
316
- message: {
317
- type: 'string',
318
- description: 'Detailed error message',
319
- },
320
- code: {
321
- type: 'string',
322
- description: 'Error code',
323
- },
324
- },
325
- },
326
- },
327
- responses: {
328
- UnauthorizedError: {
329
- description: 'Unauthorized access',
330
- },
331
- NotFoundError: {
332
- description: 'Resource not found',
333
- },
334
- InternalServerError: {
335
- description: 'Internal server error',
336
- },
337
- },
338
- },
339
- };
340
-
341
- export const swaggerOptions = {
342
- definition: swaggerDefinition,
343
- apis: [], // Using only definition, no JSDoc file scanning
344
- };
@@ -1,97 +0,0 @@
1
- import * as fs from 'fs';
2
- import * as path from 'path';
3
- import { AppLogger } from './middleware/logger';
4
-
5
- import type { MonodogConfig } from './types';
6
-
7
- // Global variable to hold the loaded config
8
- let config: MonodogConfig | null = null;
9
-
10
- /**
11
- * Loads the monodog-config.json file from the monorepo root.
12
- * This should be called only once during application startup.
13
- * @returns The application configuration object.
14
- */
15
- function loadConfig(): MonodogConfig {
16
- if (config) {
17
- return config; // Return cached config if already loaded
18
- }
19
-
20
- // 1. Determine the path to the config file
21
- // We assume the backend package is running from the monorepo root (cwd is root)
22
- // or that we can navigate up to the root from the current file's location.
23
- const rootPath = path.resolve(process.cwd());
24
- const configPath = path.resolve(rootPath, 'monodog-config.json');
25
- createConfigFileIfMissing(rootPath);
26
-
27
- if (!fs.existsSync(configPath)) {
28
- AppLogger.error(`Configuration file not found at ${configPath}`);
29
- process.exit(1);
30
- }
31
-
32
- try {
33
- // 2. Read and parse the JSON file
34
- const fileContent = fs.readFileSync(configPath, 'utf-8');
35
- const parsedConfig = JSON.parse(fileContent) as MonodogConfig;
36
-
37
- // Cache and return
38
- config = parsedConfig;
39
- return config;
40
- } catch (error) {
41
- AppLogger.error('Failed to read or parse monodog-config.json.', error as Error);
42
- process.exit(1);
43
- }
44
- }
45
-
46
- function createConfigFileIfMissing(rootPath: string): void {
47
- // --- CONFIGURATION ---
48
- const configFileName = 'monodog-config.json';
49
- const configFilePath = path.resolve(rootPath, configFileName);
50
-
51
- // The default content for the configuration file
52
- const defaultContent = {
53
- workspaces: [],
54
- database: {
55
- path: 'file:./monodog.db', // SQLite database file path, relative to prisma schema location
56
- },
57
- dashboard: {
58
- host: 'localhost',
59
- port: '3010',
60
- },
61
- server: {
62
- host: 'localhost', // Default host for the API server
63
- port: 8999, // Default port for the API server
64
- },
65
- };
66
-
67
- const contentString = JSON.stringify(defaultContent, null, 2);
68
- // ---------------------
69
-
70
- AppLogger.info(`\n[monodog] Checking for ${configFileName}...`);
71
-
72
- if (fs.existsSync(configFilePath)) {
73
- AppLogger.info(
74
- `\n[monodog] ${configFileName} already exists at ${configFilePath}. Skipping creation.`
75
- );
76
- } else {
77
- try {
78
- // Write the default content to the file
79
- fs.writeFileSync(configFilePath, contentString, 'utf-8');
80
- AppLogger.info(
81
- `[monodog] Successfully generated default ${configFileName} in the workspace root.`
82
- );
83
- process.stderr.write(
84
- '[monodog] Please review and update settings like "host" and "port".'
85
- );
86
- } catch (err: unknown) {
87
- const message = err instanceof Error ? err.message : String(err);
88
- AppLogger.error(
89
- `Failed to generate ${configFileName}: ${message}`
90
- );
91
- process.exit(1);
92
- }
93
- }
94
- }
95
- const appConfig = loadConfig();
96
- export { appConfig };
97
-
@@ -1,13 +0,0 @@
1
- /**
2
- * Constants Index
3
- * Centralized export of all application constants
4
- */
5
-
6
- // Port constants
7
- export * from './port';
8
-
9
- // Security constants
10
- export * from './security';
11
-
12
- // Middleware constants
13
- export * from './middleware';
@@ -1,83 +0,0 @@
1
- /**
2
- * Middleware Constants
3
- * Defines constants used across middleware modules
4
- */
5
-
6
- /**
7
- * HTTP status code for internal server error
8
- */
9
- export const HTTP_STATUS_INTERNAL_SERVER_ERROR = 500;
10
-
11
- /**
12
- * HTTP status code for not found
13
- */
14
- export const HTTP_STATUS_NOT_FOUND = 404;
15
-
16
- /**
17
- * HTTP status code for bad request
18
- */
19
- export const HTTP_STATUS_BAD_REQUEST = 400;
20
-
21
- /**
22
- * Error message for port already in use
23
- */
24
- export const ERROR_PORT_IN_USE = (port: number): string =>
25
- `Port ${port} is already in use. Please specify a different port.`;
26
-
27
- /**
28
- * Error message for permission denied
29
- */
30
- export const ERROR_PERMISSION_DENIED = (port: number): string =>
31
- `Permission denied to listen on port ${port}. Use a port above 1024.`;
32
-
33
- /**
34
- * Error message for internal server error
35
- */
36
- export const ERROR_INTERNAL_SERVER = 'Internal server error';
37
-
38
- /**
39
- * Success message for server start
40
- */
41
- export const SUCCESS_SERVER_START = (host: string, port: number): string =>
42
- `Backend server listening on http://${host}:${port}`;
43
-
44
- /**
45
- * Success message for dashboard start
46
- */
47
- export const SUCCESS_DASHBOARD_START = (host: string, port: number): string =>
48
- `Dashboard listening on http://${host}:${port}`;
49
-
50
- /**
51
- * Message for graceful shutdown
52
- */
53
- export const MESSAGE_GRACEFUL_SHUTDOWN = 'SIGTERM signal received: closing HTTP server';
54
-
55
- /**
56
- * Message for server closed
57
- */
58
- export const MESSAGE_SERVER_CLOSED = 'HTTP server closed';
59
-
60
- /**
61
- * Message for dashboard graceful shutdown
62
- */
63
- export const MESSAGE_DASHBOARD_GRACEFUL_SHUTDOWN = 'SIGTERM signal received: closing dashboard server';
64
-
65
- /**
66
- * Message for dashboard closed
67
- */
68
- export const MESSAGE_DASHBOARD_CLOSED = 'Dashboard server closed';
69
-
70
- /**
71
- * Content-Type header for JavaScript
72
- */
73
- export const CONTENT_TYPE_JAVASCRIPT = 'application/javascript';
74
-
75
- /**
76
- * Error serving index.html message
77
- */
78
- export const ERROR_SERVING_INDEX_HTML = 'Error serving index.html:';
79
-
80
- /**
81
- * Shutdown instruction message
82
- */
83
- export const MESSAGE_SHUTDOWN_INSTRUCTION = 'Press Ctrl+C to quit.';
@@ -1,20 +0,0 @@
1
- /**
2
- * Port Constants
3
- * Defines valid port range and port-related configuration
4
- */
5
-
6
- /**
7
- * Minimum valid port number (above system reserved ports)
8
- */
9
- export const PORT_MIN = 1024;
10
-
11
- /**
12
- * Maximum valid port number
13
- */
14
- export const PORT_MAX = 65535;
15
-
16
- /**
17
- * Port validation error message
18
- */
19
- export const PORT_VALIDATION_ERROR_MESSAGE = (min: number, max: number): string =>
20
- `Port must be between ${min} and ${max}`;
@@ -1,78 +0,0 @@
1
- /**
2
- * Security Constants
3
- * Defines security-related configuration and constants
4
- */
5
-
6
- /**
7
- * Request timeout duration in milliseconds (30 seconds)
8
- */
9
- export const REQUEST_TIMEOUT = 30000;
10
-
11
- /**
12
- * Response timeout duration in milliseconds (30 seconds)
13
- */
14
- export const RESPONSE_TIMEOUT = 30000;
15
-
16
- /**
17
- * CORS methods allowed for API
18
- */
19
- export const CORS_API_METHODS = ['GET', 'POST', 'PUT', 'DELETE', 'OPTIONS'] as const;
20
-
21
- /**
22
- * CORS headers allowed
23
- */
24
- export const CORS_ALLOWED_HEADERS = ['Content-Type', 'Authorization'] as const;
25
-
26
- /**
27
- * Body parser JSON size limit
28
- */
29
- export const BODY_PARSER_LIMIT = '1mb';
30
-
31
- /**
32
- * Cache control header for no-cache responses
33
- */
34
- export const CACHE_CONTROL_NO_CACHE = 'private, no-cache, no-store, must-revalidate';
35
-
36
- /**
37
- * Cache control header for static assets
38
- */
39
- export const CACHE_CONTROL_STATIC = '1d';
40
-
41
- /**
42
- * Default localhost hostname
43
- */
44
- export const DEFAULT_LOCALHOST = 'localhost';
45
-
46
- /**
47
- * Wildcard address for listening on all interfaces
48
- */
49
- export const WILDCARD_ADDRESS = 'localhost';
50
-
51
- /**
52
- * HTTP protocol prefix
53
- */
54
- export const HTTP_PROTOCOL = 'http://';
55
-
56
- /**
57
- * CSP directives for Helmet
58
- */
59
- export const CSP_DIRECTIVES = {
60
- defaultSrc: ["'self'"],
61
- scriptSrc: ["'self'"],
62
- imgSrc: ["'self'", 'data:', 'https:'],
63
- } as const;
64
-
65
- /**
66
- * Static file extensions pattern
67
- */
68
- export const STATIC_FILE_PATTERN = /(.ico|.js|.css|.jpg|.png|.map|.woff|.woff2|.ttf)$/i;
69
-
70
- /**
71
- * Expires header for no-cache responses
72
- */
73
- export const EXPIRES_HEADER = '-1';
74
-
75
- /**
76
- * Pragma header for no-cache responses
77
- */
78
- export const PRAGMA_HEADER = 'no-cache';
@@ -1,31 +0,0 @@
1
-
2
-
3
-
4
- import { Request, Response } from 'express';
5
- import { AppLogger } from '../middleware/logger';
6
- import { getCommitsByPathService } from '../services/commit-service';
7
-
8
- export const getCommitsByPath = async (_req: Request, res: Response) => {
9
-
10
- try {
11
- const { packagePath } = _req.params;
12
- const decodedPath = decodeURIComponent(packagePath);
13
-
14
- AppLogger.debug('Fetching commits for path: ' + decodedPath);
15
- AppLogger.debug('Current working directory: ' + process.cwd());
16
-
17
- const commits = await getCommitsByPathService(decodedPath);
18
- AppLogger.info(
19
- `Successfully fetched ${commits.length} commits for ${decodedPath}`
20
- );
21
- res.json(commits);
22
- } catch (error: unknown) {
23
- const err = error as Error & { message?: string; stack?: string };
24
- AppLogger.error('Error fetching commit details', err);
25
- res.status(500).json({
26
- error: 'Failed to fetch commit details',
27
- message: err?.message,
28
- stack: process.env.NODE_ENV === 'development' ? err?.stack : undefined,
29
- });
30
- }
31
- }