repoburg 1.0.53 → 1.0.55
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.
- package/backend/.env +3 -1
- package/backend/dist/context-generation/context-generation.service.d.ts +1 -1
- package/backend/dist/context-generation/context-generation.service.js.map +1 -1
- package/backend/dist/session-inputs/session-input-context.service.js +8 -3
- package/backend/dist/session-inputs/session-input-context.service.js.map +1 -1
- package/backend/dist/tsconfig.build.tsbuildinfo +1 -1
- package/backend/dist/utils/fuzzy-search.d.ts +1 -0
- package/backend/dist/utils/fuzzy-search.js +45 -0
- package/backend/dist/utils/fuzzy-search.js.map +1 -0
- package/backend/dist/utils/index.d.ts +1 -0
- package/backend/dist/utils/index.js +18 -0
- package/backend/dist/utils/index.js.map +1 -0
- package/backend/dist/workspace/workspace.service.d.ts +1 -0
- package/backend/dist/workspace/workspace.service.js +49 -59
- package/backend/dist/workspace/workspace.service.js.map +1 -1
- package/backend/package.json +1 -1
- package/package.json +1 -1
- package/platform-cli.js +42 -41
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function fuzzySearch(query: string, items: string[]): string[];
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.fuzzySearch = fuzzySearch;
|
|
4
|
+
function fuzzySearch(query, items) {
|
|
5
|
+
if (!query) {
|
|
6
|
+
return items;
|
|
7
|
+
}
|
|
8
|
+
const lowerCaseQuery = query.toLowerCase();
|
|
9
|
+
const rankedItems = items
|
|
10
|
+
.map((item) => {
|
|
11
|
+
const lowerCaseItem = item.toLowerCase();
|
|
12
|
+
let score = 0;
|
|
13
|
+
let consecutiveMatches = 0;
|
|
14
|
+
let lastMatchIndex = -1;
|
|
15
|
+
for (let i = 0; i < lowerCaseQuery.length; i++) {
|
|
16
|
+
const char = lowerCaseQuery[i];
|
|
17
|
+
const foundIndex = lowerCaseItem.indexOf(char, lastMatchIndex + 1);
|
|
18
|
+
if (foundIndex === -1) {
|
|
19
|
+
return null;
|
|
20
|
+
}
|
|
21
|
+
if (foundIndex === 0 ||
|
|
22
|
+
['/', '\\', '_', '-', '.'].includes(lowerCaseItem[foundIndex - 1])) {
|
|
23
|
+
score += 15;
|
|
24
|
+
}
|
|
25
|
+
if (item[foundIndex] === query[i]) {
|
|
26
|
+
score += 5;
|
|
27
|
+
}
|
|
28
|
+
if (lastMatchIndex === foundIndex - 1) {
|
|
29
|
+
consecutiveMatches++;
|
|
30
|
+
score += 20 * consecutiveMatches;
|
|
31
|
+
}
|
|
32
|
+
else {
|
|
33
|
+
consecutiveMatches = 0;
|
|
34
|
+
}
|
|
35
|
+
score -= foundIndex - (lastMatchIndex + 1);
|
|
36
|
+
lastMatchIndex = foundIndex;
|
|
37
|
+
}
|
|
38
|
+
score -= item.length * 0.1;
|
|
39
|
+
return { item, score };
|
|
40
|
+
})
|
|
41
|
+
.filter((result) => result !== null);
|
|
42
|
+
rankedItems.sort((a, b) => b.score - a.score);
|
|
43
|
+
return rankedItems.map((result) => result.item);
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=fuzzy-search.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fuzzy-search.js","sourceRoot":"","sources":["../../src/utils/fuzzy-search.ts"],"names":[],"mappings":";;AAAA,kCA8DC;AA9DD,SAAgB,WAAW,CAAC,KAAa,EAAE,KAAe;IACxD,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,OAAO,KAAK,CAAC;IACf,CAAC;IAED,MAAM,cAAc,GAAG,KAAK,CAAC,WAAW,EAAE,CAAC;IAE3C,MAAM,WAAW,GAAG,KAAK;SACtB,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;QACZ,MAAM,aAAa,GAAG,IAAI,CAAC,WAAW,EAAE,CAAC;QACzC,IAAI,KAAK,GAAG,CAAC,CAAC;QACd,IAAI,kBAAkB,GAAG,CAAC,CAAC;QAC3B,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,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC;IAE9C,OAAO,WAAW,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;AAClD,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './fuzzy-search';
|
|
@@ -0,0 +1,18 @@
|
|
|
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 __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./fuzzy-search"), exports);
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,iDAA+B"}
|
|
@@ -12,6 +12,7 @@ export declare class WorkspaceService {
|
|
|
12
12
|
private fileTreeCacheTimestamp;
|
|
13
13
|
private readonly CACHE_TTL_MS;
|
|
14
14
|
constructor(contextGenerationService: ContextGenerationService);
|
|
15
|
+
private getFilesFromRg;
|
|
15
16
|
private resolveAndValidatePath;
|
|
16
17
|
validatePaths(paths: {
|
|
17
18
|
files?: string[];
|
|
@@ -12,10 +12,13 @@ var WorkspaceService_1;
|
|
|
12
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
13
|
exports.WorkspaceService = void 0;
|
|
14
14
|
const common_1 = require("@nestjs/common");
|
|
15
|
-
const glob_1 = require("glob");
|
|
16
15
|
const context_generation_service_1 = require("../context-generation/context-generation.service");
|
|
17
16
|
const fs = require("fs/promises");
|
|
18
17
|
const path = require("path");
|
|
18
|
+
const utils_1 = require("../utils");
|
|
19
|
+
const child_process_1 = require("child_process");
|
|
20
|
+
const util_1 = require("util");
|
|
21
|
+
const execAsync = (0, util_1.promisify)(child_process_1.exec);
|
|
19
22
|
let WorkspaceService = WorkspaceService_1 = class WorkspaceService {
|
|
20
23
|
constructor(contextGenerationService) {
|
|
21
24
|
this.contextGenerationService = contextGenerationService;
|
|
@@ -25,6 +28,27 @@ let WorkspaceService = WorkspaceService_1 = class WorkspaceService {
|
|
|
25
28
|
this.fileTreeCacheTimestamp = null;
|
|
26
29
|
this.CACHE_TTL_MS = 5 * 60 * 1000;
|
|
27
30
|
}
|
|
31
|
+
async getFilesFromRg() {
|
|
32
|
+
const rgCommand = await this.contextGenerationService.getCommandPath('rg');
|
|
33
|
+
const command = `${rgCommand} --files --hidden --glob '!.git'`;
|
|
34
|
+
try {
|
|
35
|
+
this.logger.log(`Executing for file list: ${command}`);
|
|
36
|
+
const { stdout } = await execAsync(command, {
|
|
37
|
+
cwd: this.projectRoot,
|
|
38
|
+
maxBuffer: 256 * 1024 * 1024,
|
|
39
|
+
timeout: 10000,
|
|
40
|
+
});
|
|
41
|
+
return stdout.trim().split('\n').filter(Boolean);
|
|
42
|
+
}
|
|
43
|
+
catch (error) {
|
|
44
|
+
if (error.code === 1 && error.stdout === '' && error.stderr === '') {
|
|
45
|
+
this.logger.log('rg --files returned no files.');
|
|
46
|
+
return [];
|
|
47
|
+
}
|
|
48
|
+
this.logger.error(`Failed to get file list from rg: ${error.message}`, error.stack);
|
|
49
|
+
throw new Error(`Could not retrieve file list from RipGrep. Is 'rg' installed and in your PATH?`);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
28
52
|
resolveAndValidatePath(unsafePath) {
|
|
29
53
|
const normalizedPath = path.normalize(unsafePath);
|
|
30
54
|
if (path.isAbsolute(normalizedPath)) {
|
|
@@ -62,28 +86,17 @@ let WorkspaceService = WorkspaceService_1 = class WorkspaceService {
|
|
|
62
86
|
this.logger.log('Returning file tree from cache.');
|
|
63
87
|
return this.fileTreeCache;
|
|
64
88
|
}
|
|
65
|
-
this.logger.log(`Scanning project root for file tree: ${this.projectRoot}`);
|
|
89
|
+
this.logger.log(`Scanning project root for file tree with rg: ${this.projectRoot}`);
|
|
66
90
|
try {
|
|
67
|
-
const
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
];
|
|
75
|
-
const files = await (0, glob_1.glob)('**/*', {
|
|
76
|
-
cwd: this.projectRoot,
|
|
77
|
-
nodir: true,
|
|
78
|
-
ignore: ignorePatterns,
|
|
79
|
-
dot: true,
|
|
91
|
+
const files = await this.getFilesFromRg();
|
|
92
|
+
const folderSet = new Set();
|
|
93
|
+
files.forEach((file) => {
|
|
94
|
+
const parts = file.split(path.sep);
|
|
95
|
+
for (let i = 1; i < parts.length; i++) {
|
|
96
|
+
folderSet.add(parts.slice(0, i).join(path.sep));
|
|
97
|
+
}
|
|
80
98
|
});
|
|
81
|
-
const
|
|
82
|
-
cwd: this.projectRoot,
|
|
83
|
-
ignore: ignorePatterns,
|
|
84
|
-
dot: true,
|
|
85
|
-
});
|
|
86
|
-
const folders = allDirs.map((d) => d.replace(/\/$/, '')).filter((d) => d);
|
|
99
|
+
const folders = Array.from(folderSet);
|
|
87
100
|
this.logger.log(`Found ${files.length} files and ${folders.length} folders.`);
|
|
88
101
|
this.fileTreeCache = { files, folders };
|
|
89
102
|
this.fileTreeCacheTimestamp = now;
|
|
@@ -101,54 +114,31 @@ let WorkspaceService = WorkspaceService_1 = class WorkspaceService {
|
|
|
101
114
|
}
|
|
102
115
|
async search(query, type, page, limit) {
|
|
103
116
|
this.logger.log(`Searching for "${query}" (type: ${type})`);
|
|
104
|
-
const
|
|
105
|
-
|
|
106
|
-
'**/.git/**',
|
|
107
|
-
'**/dist/**',
|
|
108
|
-
'**/coverage/**',
|
|
109
|
-
'**/.next/**',
|
|
110
|
-
'**/data.json',
|
|
111
|
-
];
|
|
112
|
-
const globOptions = {
|
|
113
|
-
cwd: this.projectRoot,
|
|
114
|
-
ignore: ignorePatterns,
|
|
115
|
-
dot: true,
|
|
116
|
-
};
|
|
117
|
-
const globPattern = `**/*${query}*`;
|
|
118
|
-
const allMatches = await (0, glob_1.glob)(globPattern, {
|
|
119
|
-
...globOptions,
|
|
120
|
-
mark: true,
|
|
121
|
-
nocase: true,
|
|
122
|
-
});
|
|
123
|
-
let results = [];
|
|
117
|
+
const { files, folders } = await this.getFileTree();
|
|
118
|
+
let searchPool = [];
|
|
124
119
|
if (type === 'all') {
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
120
|
+
searchPool = [
|
|
121
|
+
...files.map((p) => ({ path: p, type: 'file' })),
|
|
122
|
+
...folders.map((p) => ({ path: p, type: 'folder' })),
|
|
123
|
+
];
|
|
129
124
|
}
|
|
130
125
|
else if (type === 'files') {
|
|
131
|
-
|
|
132
|
-
.filter((p) => !p.endsWith('/'))
|
|
133
|
-
.map((p) => ({ type: 'file', path: p }));
|
|
126
|
+
searchPool = files.map((p) => ({ path: p, type: 'file' }));
|
|
134
127
|
}
|
|
135
128
|
else if (type === 'folders') {
|
|
136
|
-
|
|
137
|
-
.filter((p) => p.endsWith('/'))
|
|
138
|
-
.map((p) => ({ type: 'folder', path: p.slice(0, -1) }));
|
|
129
|
+
searchPool = folders.map((p) => ({ path: p, type: 'folder' }));
|
|
139
130
|
}
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
});
|
|
131
|
+
const searchPoolStrings = searchPool.map((item) => item.path);
|
|
132
|
+
const matchedPaths = (0, utils_1.fuzzySearch)(query, searchPoolStrings);
|
|
133
|
+
const matchedPathSet = new Set(matchedPaths);
|
|
134
|
+
const results = searchPool
|
|
135
|
+
.filter((item) => matchedPathSet.has(item.path))
|
|
136
|
+
.sort((a, b) => matchedPaths.indexOf(a.path) - matchedPaths.indexOf(b.path));
|
|
147
137
|
const total = results.length;
|
|
148
138
|
const startIndex = (page - 1) * limit;
|
|
149
139
|
const endIndex = page * limit;
|
|
150
140
|
const paginatedResults = results.slice(startIndex, endIndex);
|
|
151
|
-
this.logger.log(`Search for "${query}" (type: ${type})
|
|
141
|
+
this.logger.log(`Search for "${query}" (type: ${type}) found ${total} total results. Returning page ${page} with ${paginatedResults.length} items.`);
|
|
152
142
|
return {
|
|
153
143
|
results: paginatedResults,
|
|
154
144
|
total,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workspace.service.js","sourceRoot":"","sources":["../../src/workspace/workspace.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,2CAAyE;AACzE
|
|
1
|
+
{"version":3,"file":"workspace.service.js","sourceRoot":"","sources":["../../src/workspace/workspace.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,2CAAyE;AACzE,iGAA4F;AAK5F,kCAAkC;AAClC,6BAA6B;AAC7B,oCAAuC;AACvC,iDAAqC;AACrC,+BAAiC;AAEjC,MAAM,SAAS,GAAG,IAAA,gBAAS,EAAC,oBAAI,CAAC,CAAC;AAQ3B,IAAM,gBAAgB,wBAAtB,MAAM,gBAAgB;IAU3B,YACmB,wBAAkD;QAAlD,6BAAwB,GAAxB,wBAAwB,CAA0B;QAVpD,WAAM,GAAG,IAAI,eAAM,CAAC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AE,QAAQ,GAAG,KAAK;SAC1B,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,cAAc,CAAC,QAAgB;QACnC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,6BAA6B,QAAQ,EAAE,CAAC,CAAC;QAEzD,OAAO,IAAI,CAAC,wBAAwB,CAAC,gBAAgB,CAAC,QAAQ,CAAC,CAAC;IAClE,CAAC;CACF,CAAA;AAzLY,4CAAgB;2BAAhB,gBAAgB;IAD5B,IAAA,mBAAU,GAAE;qCAYkC,qDAAwB;GAX1D,gBAAgB,CAyL5B"}
|
package/backend/package.json
CHANGED
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
"build": "nest build",
|
|
10
10
|
"format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"",
|
|
11
11
|
"start": "nest start",
|
|
12
|
+
"start2": "NODE_ENV=production nest start",
|
|
12
13
|
"start:dev": "nest start --watch",
|
|
13
14
|
"start:debug": "nest start --debug --watch",
|
|
14
15
|
"start:prod": "NODE_ENV=production node dist/main",
|
|
@@ -29,7 +30,6 @@
|
|
|
29
30
|
"@nestjs/schematics": "^10.0.0",
|
|
30
31
|
"@nestjs/testing": "^10.0.0",
|
|
31
32
|
"@types/express": "^4.17.17",
|
|
32
|
-
"@types/glob": "^8.1.0",
|
|
33
33
|
"@types/jest": "^29.5.2",
|
|
34
34
|
"@types/multer": "^1.4.11",
|
|
35
35
|
"@types/node": "^20.3.1",
|
package/package.json
CHANGED
package/platform-cli.js
CHANGED
|
@@ -178,42 +178,43 @@ program
|
|
|
178
178
|
authResponse = await axios.get(`${DAEMON_BASE_URL}/auth/status`);
|
|
179
179
|
} catch (error) {
|
|
180
180
|
if (error.request && !error.response) {
|
|
181
|
-
console.log(chalk.yellow('Daemon not reachable. Attempting to start it now...'));
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
};
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
181
|
+
// console.log(chalk.yellow('Daemon not reachable. Attempting to start it now...'));
|
|
182
|
+
|
|
183
|
+
// TODO restore here once pm2 daemon bug is fixed
|
|
184
|
+
// await startDaemon();
|
|
185
|
+
//
|
|
186
|
+
// const pollForDaemonHealth = (timeout = 30000) => {
|
|
187
|
+
// const spinner = ora('Waiting for daemon to become healthy...').start();
|
|
188
|
+
// return new Promise((resolve, reject) => {
|
|
189
|
+
// const startTime = Date.now();
|
|
190
|
+
// const pollInterval = setInterval(async () => {
|
|
191
|
+
// if (Date.now() - startTime > timeout) {
|
|
192
|
+
// clearInterval(pollInterval);
|
|
193
|
+
// spinner.fail('Daemon health check timed out.');
|
|
194
|
+
// return reject(new Error('Daemon health check timed out. Check logs with `repoburg daemon logs`.'));
|
|
195
|
+
// }
|
|
196
|
+
// try {
|
|
197
|
+
// await axios.get(`${DAEMON_BASE_URL}/health`);
|
|
198
|
+
// clearInterval(pollInterval);
|
|
199
|
+
// spinner.succeed('Daemon is healthy.');
|
|
200
|
+
// resolve();
|
|
201
|
+
// } catch (e) {
|
|
202
|
+
// // ignore until timeout
|
|
203
|
+
// }
|
|
204
|
+
// }, 1000)
|
|
205
|
+
// });
|
|
206
|
+
// };
|
|
207
|
+
//
|
|
208
|
+
// await pollForDaemonHealth();
|
|
209
|
+
|
|
210
|
+
// try {
|
|
211
|
+
// authResponse = await axios.get(`${DAEMON_BASE_URL}/auth/status`);
|
|
212
|
+
// } catch (retryError) {
|
|
213
|
+
// console.error(chalk.red('Daemon started but is not responding correctly.'));
|
|
214
|
+
// return handleApiError(retryError);
|
|
215
|
+
// }
|
|
215
216
|
} else {
|
|
216
|
-
return handleApiError(error);
|
|
217
|
+
// return handleApiError(error);
|
|
217
218
|
}
|
|
218
219
|
}
|
|
219
220
|
|
|
@@ -314,7 +315,7 @@ program
|
|
|
314
315
|
}
|
|
315
316
|
|
|
316
317
|
console.log(chalk.green('✓ All services processed:'));
|
|
317
|
-
|
|
318
|
+
|
|
318
319
|
const Table = require('cli-table3');
|
|
319
320
|
const table = new Table({
|
|
320
321
|
head: ['NAME', 'RESULT'].map(h => chalk.cyan(h)),
|
|
@@ -405,7 +406,7 @@ program
|
|
|
405
406
|
.action(async () => {
|
|
406
407
|
const { default: chalk } = await import('chalk');
|
|
407
408
|
const { default: ora } = await import('ora');
|
|
408
|
-
|
|
409
|
+
|
|
409
410
|
const runCommand = (command, args) => {
|
|
410
411
|
return new Promise((resolve, reject) => {
|
|
411
412
|
const spinner = ora(`Running \`${command} ${args.join(' ')}\`...`).start();
|
|
@@ -572,7 +573,7 @@ daemon
|
|
|
572
573
|
pm2.disconnect();
|
|
573
574
|
process.exit(1);
|
|
574
575
|
}
|
|
575
|
-
|
|
576
|
+
|
|
576
577
|
const daemonProcess = list.find(p => p.name === DAEMON_PM2_NAME);
|
|
577
578
|
if (!daemonProcess) {
|
|
578
579
|
console.log(chalk.yellow(`Daemon process "${DAEMON_PM2_NAME}" is not running or not managed by pm2.`));
|
|
@@ -657,7 +658,7 @@ daemon
|
|
|
657
658
|
process.exit(1);
|
|
658
659
|
}
|
|
659
660
|
});
|
|
660
|
-
|
|
661
|
+
|
|
661
662
|
daemon
|
|
662
663
|
.command('delete')
|
|
663
664
|
.alias('rm')
|
|
@@ -730,7 +731,7 @@ daemon
|
|
|
730
731
|
|
|
731
732
|
await readAndPrint(outLogPath, 'Output');
|
|
732
733
|
await readAndPrint(errLogPath, 'Error');
|
|
733
|
-
|
|
734
|
+
|
|
734
735
|
pm2.disconnect();
|
|
735
736
|
});
|
|
736
737
|
} catch (error) {
|
|
@@ -739,4 +740,4 @@ daemon
|
|
|
739
740
|
}
|
|
740
741
|
});
|
|
741
742
|
|
|
742
|
-
program.parse(process.argv);
|
|
743
|
+
program.parse(process.argv);
|