@edgible-team/cli 1.2.0 → 1.2.2
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/dist/commands/agent.d.ts.map +1 -1
- package/dist/commands/agent.js +6 -1
- package/dist/interfaces/IDaemonManager.d.ts +11 -1
- package/dist/interfaces/IDaemonManager.d.ts.map +1 -1
- package/dist/services/daemon/DockerDaemonManager.d.ts +4 -1
- package/dist/services/daemon/DockerDaemonManager.d.ts.map +1 -1
- package/dist/services/daemon/DockerDaemonManager.js +1 -1
- package/dist/services/daemon/LaunchdDaemonManager.d.ts +4 -1
- package/dist/services/daemon/LaunchdDaemonManager.d.ts.map +1 -1
- package/dist/services/daemon/LaunchdDaemonManager.js +70 -26
- package/dist/services/daemon/PodmanDaemonManager.d.ts +4 -1
- package/dist/services/daemon/PodmanDaemonManager.d.ts.map +1 -1
- package/dist/services/daemon/PodmanDaemonManager.js +1 -1
- package/dist/services/daemon/SystemdDaemonManager.d.ts +4 -1
- package/dist/services/daemon/SystemdDaemonManager.d.ts.map +1 -1
- package/dist/services/daemon/SystemdDaemonManager.js +1 -1
- package/dist/services/daemon/WindowsServiceDaemonManager.d.ts +4 -1
- package/dist/services/daemon/WindowsServiceDaemonManager.d.ts.map +1 -1
- package/dist/services/daemon/WindowsServiceDaemonManager.js +3 -2
- package/dist/utils/PathResolver.d.ts +14 -0
- package/dist/utils/PathResolver.d.ts.map +1 -1
- package/dist/utils/PathResolver.js +24 -0
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent.d.ts","sourceRoot":"","sources":["../../src/commands/agent.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AA2BpC,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"agent.d.ts","sourceRoot":"","sources":["../../src/commands/agent.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AA2BpC,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CA63CzD"}
|
package/dist/commands/agent.js
CHANGED
|
@@ -853,6 +853,8 @@ function setupAgentCommands(program) {
|
|
|
853
853
|
.option('-m, --module <module>', 'Filter logs by module name (comma-separated for multiple modules, e.g., "agent,caddy")')
|
|
854
854
|
.option('-c, --comprehensive', 'Show comprehensive diagnostics (raw output without filtering)')
|
|
855
855
|
.option('--single-line', 'Exclude data and error traces from output (single line per log entry)')
|
|
856
|
+
.option('--stdout', 'Read from stdout.log instead of agent.log')
|
|
857
|
+
.option('--stderr', 'Read from stderr.log instead of agent.log')
|
|
856
858
|
.action((0, command_wrapper_1.wrapCommand)(async (options) => {
|
|
857
859
|
const container = (0, container_1.getContainer)();
|
|
858
860
|
const configRepository = container.get(types_1.TYPES.ConfigRepository);
|
|
@@ -874,7 +876,10 @@ function setupAgentCommands(program) {
|
|
|
874
876
|
const comprehensive = options.comprehensive || false;
|
|
875
877
|
const singleLine = options.singleLine || false;
|
|
876
878
|
try {
|
|
877
|
-
const rawLogs = await daemonManager.logs(follow, lines
|
|
879
|
+
const rawLogs = await daemonManager.logs(follow, lines, {
|
|
880
|
+
stdout: options.stdout,
|
|
881
|
+
stderr: options.stderr
|
|
882
|
+
});
|
|
878
883
|
// For follow mode, logs are streamed directly and rawLogs will be empty
|
|
879
884
|
if (follow) {
|
|
880
885
|
return;
|
|
@@ -15,6 +15,12 @@ export interface DaemonConfig {
|
|
|
15
15
|
agentPath: string;
|
|
16
16
|
logPath?: string;
|
|
17
17
|
}
|
|
18
|
+
export interface LogsOptions {
|
|
19
|
+
follow: boolean;
|
|
20
|
+
lines?: number;
|
|
21
|
+
stdout?: boolean;
|
|
22
|
+
stderr?: boolean;
|
|
23
|
+
}
|
|
18
24
|
export interface IDaemonManager {
|
|
19
25
|
/**
|
|
20
26
|
* Install and configure the daemon
|
|
@@ -40,9 +46,13 @@ export interface IDaemonManager {
|
|
|
40
46
|
* View daemon logs
|
|
41
47
|
* @param follow - If true, continuously stream logs (returns empty string and streams to stdout)
|
|
42
48
|
* @param lines - Number of log lines to retrieve
|
|
49
|
+
* @param options - Optional log source options (stdout, stderr). If neither specified, reads from agent.log
|
|
43
50
|
* @returns Log content as string (empty if follow mode)
|
|
44
51
|
*/
|
|
45
|
-
logs(follow: boolean, lines?: number
|
|
52
|
+
logs(follow: boolean, lines?: number, options?: {
|
|
53
|
+
stdout?: boolean;
|
|
54
|
+
stderr?: boolean;
|
|
55
|
+
}): Promise<string>;
|
|
46
56
|
/**
|
|
47
57
|
* Enable daemon to start on boot
|
|
48
58
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IDaemonManager.d.ts","sourceRoot":"","sources":["../../src/interfaces/IDaemonManager.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,OAAO,CAAC;IACjB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,YAAY;IAC3B,QAAQ,EAAE,MAAM,CAAC;IACjB,cAAc,EAAE,MAAM,CAAC;IACvB,UAAU,EAAE,SAAS,GAAG,SAAS,CAAC;IAClC,UAAU,EAAE,MAAM,CAAC;IACnB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,cAAc;IAC7B;;OAEG;IACH,OAAO,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAE7C;;OAEG;IACH,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAEvB;;OAEG;IACH,IAAI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M,IAAI,OAAO,CAAC,YAAY,CAAC,CAAC;IAEhC;;;;;;OAMG;IACH,IAAI,CAAC,MAAM,EAAE,OAAO,EAAE,KAAK,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;QAAE,MAAM,CAAC,EAAE,OAAO,CAAC;QAAC,MAAM,CAAC,EAAE,OAAO,CAAA;KAAE,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAEzG;;OAEG;IACH,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAExB;;OAEG;IACH,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAEzB;;OAEG;IACH,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAE3B;;OAEG;IACH,WAAW,IAAI,MAAM,CAAC;IAEtB;;OAEG;IACH,OAAO,IAAI,SAAS,GAAG,SAAS,GAAG,iBAAiB,GAAG,QAAQ,GAAG,QAAQ,CAAC;CAC5E"}
|
|
@@ -9,7 +9,10 @@ export declare class DockerDaemonManager implements IDaemonManager {
|
|
|
9
9
|
stop(): Promise<void>;
|
|
10
10
|
restart(): Promise<void>;
|
|
11
11
|
status(): Promise<DaemonStatus>;
|
|
12
|
-
logs(follow: boolean, lines?: number
|
|
12
|
+
logs(follow: boolean, lines?: number, options?: {
|
|
13
|
+
stdout?: boolean;
|
|
14
|
+
stderr?: boolean;
|
|
15
|
+
}): Promise<string>;
|
|
13
16
|
enable(): Promise<void>;
|
|
14
17
|
disable(): Promise<void>;
|
|
15
18
|
uninstall(): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DockerDaemonManager.d.ts","sourceRoot":"","sources":["../../../src/services/daemon/DockerDaemonManager.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAM7F,qBAAa,mBAAoB,YAAW,cAAc;IACxD,OAAO,CAAC,aAAa,CAA2B;IAChD,OAAO,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AS,IAAI,OAAO,CAAC,IAAI,CAAC;IAkBhC,WAAW,IAAI,MAAM;IAIrB,OAAO,IAAI,SAAS,GAAG,SAAS,GAAG,iBAAiB,GAAG,QAAQ,GAAG,QAAQ;YAI5D,gBAAgB;YAShB,UAAU;IAqBxB,OAAO,CAAC,wBAAwB;YA+DlB,oBAAoB;YASpB,oBAAoB;YAwBpB,oBAAoB;YA+BpB,oBAAoB;CAkBnC"}
|
|
@@ -9,7 +9,10 @@ export declare class LaunchdDaemonManager implements IDaemonManager {
|
|
|
9
9
|
stop(): Promise<void>;
|
|
10
10
|
restart(): Promise<void>;
|
|
11
11
|
status(): Promise<DaemonStatus>;
|
|
12
|
-
logs(follow: boolean, lines?: number
|
|
12
|
+
logs(follow: boolean, lines?: number, options?: {
|
|
13
|
+
stdout?: boolean;
|
|
14
|
+
stderr?: boolean;
|
|
15
|
+
}): Promise<string>;
|
|
13
16
|
enable(): Promise<void>;
|
|
14
17
|
disable(): Promise<void>;
|
|
15
18
|
uninstall(): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LaunchdDaemonManager.d.ts","sourceRoot":"","sources":["../../../src/services/daemon/LaunchdDaemonManager.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAM7F,qBAAa,oBAAqB,YAAW,cAAc;IACzD,OAAO,CAAC,WAAW,CAA+B;IAClD,OAAO,CAAC,SAAS,CAAS;IAC1B,OAAO,CAAC,OAAO,CAAS;;IAYlB,OAAO,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC;IAqB5C,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAStB,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IASrB,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAOxB,MAAM,IAAI,OAAO,CAAC,YAAY,CAAC;IAiC/B,IAAI,CAAC,MAAM,EAAE,OAAO,EAAE,KAAK,GAAE,MAAY,GAAG,OAAO,CAAC,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"LaunchdDaemonManager.d.ts","sourceRoot":"","sources":["../../../src/services/daemon/LaunchdDaemonManager.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAM7F,qBAAa,oBAAqB,YAAW,cAAc;IACzD,OAAO,CAAC,WAAW,CAA+B;IAClD,OAAO,CAAC,SAAS,CAAS;IAC1B,OAAO,CAAC,OAAO,CAAS;;IAYlB,OAAO,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC;IAqB5C,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAStB,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IASrB,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAOxB,MAAM,IAAI,OAAO,CAAC,YAAY,CAAC;IAiC/B,IAAI,CAAC,MAAM,EAAE,OAAO,EAAE,KAAK,GAAE,MAAY,EAAE,OAAO,CAAC,EAAE;QAAE,MAAM,CAAC,EAAE,OAAO,CAAC;QAAC,MAAM,CAAC,EAAE,OAAO,CAAA;KAAE,GAAG,OAAO,CAAC,MAAM,CAAC;IAsJ7G,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC;IAUvB,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAQxB,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC;IAgBhC,WAAW,IAAI,MAAM;IAIrB,OAAO,IAAI,SAAS,GAAG,SAAS,GAAG,iBAAiB,GAAG,QAAQ,GAAG,QAAQ;IAI1E,OAAO,CAAC,iBAAiB;CA8C1B"}
|
|
@@ -125,47 +125,91 @@ class LaunchdDaemonManager {
|
|
|
125
125
|
};
|
|
126
126
|
}
|
|
127
127
|
}
|
|
128
|
-
async logs(follow, lines = 100) {
|
|
128
|
+
async logs(follow, lines = 100, options) {
|
|
129
129
|
const stdoutLog = path.join(this.logPath, 'stdout.log');
|
|
130
130
|
const stderrLog = path.join(this.logPath, 'stderr.log');
|
|
131
|
+
const agentLog = PathResolver_1.PathResolver.resolveAgentLogPath('launchd');
|
|
132
|
+
// Determine which log source to use
|
|
133
|
+
const useStdout = options?.stdout;
|
|
134
|
+
const useStderr = options?.stderr;
|
|
135
|
+
const useAgentLog = !useStdout && !useStderr; // Default to agent.log if neither flag is specified
|
|
131
136
|
if (follow) {
|
|
132
137
|
// Use tail -f for following logs
|
|
133
138
|
const { spawn } = require('child_process');
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
139
|
+
if (useAgentLog) {
|
|
140
|
+
console.log('==> agent.log <==');
|
|
141
|
+
const agentProc = spawn('tail', ['-f', '-n', String(lines), agentLog], {
|
|
142
|
+
stdio: 'inherit'
|
|
143
|
+
});
|
|
144
|
+
process.on('SIGINT', () => {
|
|
145
|
+
agentProc.kill('SIGTERM');
|
|
146
|
+
process.exit(0);
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
else {
|
|
150
|
+
if (useStdout) {
|
|
151
|
+
console.log('==> stdout.log <==');
|
|
152
|
+
const stdoutProc = spawn('tail', ['-f', '-n', String(lines), stdoutLog], {
|
|
153
|
+
stdio: 'inherit'
|
|
154
|
+
});
|
|
155
|
+
process.on('SIGINT', () => {
|
|
156
|
+
stdoutProc.kill('SIGTERM');
|
|
157
|
+
process.exit(0);
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
if (useStderr) {
|
|
161
|
+
console.log('\n==> stderr.log <==');
|
|
162
|
+
const stderrProc = spawn('tail', ['-f', '-n', String(lines), stderrLog], {
|
|
163
|
+
stdio: 'inherit'
|
|
164
|
+
});
|
|
165
|
+
process.on('SIGINT', () => {
|
|
166
|
+
stderrProc.kill('SIGTERM');
|
|
167
|
+
process.exit(0);
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
}
|
|
148
171
|
// Return empty string for follow mode as logs are streamed to stdout
|
|
149
172
|
return '';
|
|
150
173
|
}
|
|
151
174
|
else {
|
|
152
175
|
try {
|
|
153
|
-
//
|
|
176
|
+
// If using agent.log (default), read from it directly
|
|
177
|
+
if (useAgentLog) {
|
|
178
|
+
try {
|
|
179
|
+
const { stdout: agentContent } = await execAsync(`tail -n ${lines} "${agentLog}"`);
|
|
180
|
+
return agentContent;
|
|
181
|
+
}
|
|
182
|
+
catch (error) {
|
|
183
|
+
throw new Error(`Failed to read agent.log: ${error instanceof Error ? error.message : String(error)}`);
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
// Otherwise, read from stdout/stderr as specified
|
|
154
187
|
let stdoutLines = [];
|
|
155
188
|
let stderrLines = [];
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
189
|
+
if (useStdout) {
|
|
190
|
+
try {
|
|
191
|
+
const { stdout: stdoutContent } = await execAsync(`tail -n ${lines} ${stdoutLog}`);
|
|
192
|
+
stdoutLines = stdoutContent.split('\n').filter(line => line.trim());
|
|
193
|
+
}
|
|
194
|
+
catch (error) {
|
|
195
|
+
// File might not exist yet
|
|
196
|
+
}
|
|
159
197
|
}
|
|
160
|
-
|
|
161
|
-
|
|
198
|
+
if (useStderr) {
|
|
199
|
+
try {
|
|
200
|
+
const { stdout: stderrContent } = await execAsync(`tail -n ${lines} ${stderrLog}`);
|
|
201
|
+
stderrLines = stderrContent.split('\n').filter(line => line.trim());
|
|
202
|
+
}
|
|
203
|
+
catch (error) {
|
|
204
|
+
// File might not exist yet
|
|
205
|
+
}
|
|
162
206
|
}
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
207
|
+
// If only one source is requested, return it directly
|
|
208
|
+
if (useStdout && !useStderr) {
|
|
209
|
+
return stdoutLines.join('\n');
|
|
166
210
|
}
|
|
167
|
-
|
|
168
|
-
|
|
211
|
+
if (useStderr && !useStdout) {
|
|
212
|
+
return stderrLines.join('\n');
|
|
169
213
|
}
|
|
170
214
|
const parsedLogs = [];
|
|
171
215
|
// Parse stdout logs
|
|
@@ -10,7 +10,10 @@ export declare class PodmanDaemonManager implements IDaemonManager {
|
|
|
10
10
|
stop(): Promise<void>;
|
|
11
11
|
restart(): Promise<void>;
|
|
12
12
|
status(): Promise<DaemonStatus>;
|
|
13
|
-
logs(follow: boolean, lines?: number
|
|
13
|
+
logs(follow: boolean, lines?: number, options?: {
|
|
14
|
+
stdout?: boolean;
|
|
15
|
+
stderr?: boolean;
|
|
16
|
+
}): Promise<string>;
|
|
14
17
|
enable(): Promise<void>;
|
|
15
18
|
disable(): Promise<void>;
|
|
16
19
|
uninstall(): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PodmanDaemonManager.d.ts","sourceRoot":"","sources":["../../../src/services/daemon/PodmanDaemonManager.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAM7F,qBAAa,mBAAoB,YAAW,cAAc;IACxD,OAAO,CAAC,aAAa,CAA2B;IAChD,OAAO,CAAC,SAAS,CAAkC;IACnD,OAAO,CAAC,QAAQ,CAA+B;IAC/C,OAAO,CAAC,eAAe,CAAS;;IAO1B,OAAO,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC;IAkC5C,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IActB,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAarB,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAaxB,MAAM,IAAI,OAAO,CAAC,YAAY,CAAC;IAkD/B,IAAI,CAAC,MAAM,EAAE,OAAO,EAAE,KAAK,GAAE,MAAY,GAAG,OAAO,CAAC,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"PodmanDaemonManager.d.ts","sourceRoot":"","sources":["../../../src/services/daemon/PodmanDaemonManager.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAM7F,qBAAa,mBAAoB,YAAW,cAAc;IACxD,OAAO,CAAC,aAAa,CAA2B;IAChD,OAAO,CAAC,SAAS,CAAkC;IACnD,OAAO,CAAC,QAAQ,CAA+B;IAC/C,OAAO,CAAC,eAAe,CAAS;;IAO1B,OAAO,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC;IAkC5C,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IActB,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAarB,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAaxB,MAAM,IAAI,OAAO,CAAC,YAAY,CAAC;IAkD/B,IAAI,CAAC,MAAM,EAAE,OAAO,EAAE,KAAK,GAAE,MAAY,EAAE,OAAO,CAAC,EAAE;QAAE,MAAM,CAAC,EAAE,OAAO,CAAC;QAAC,MAAM,CAAC,EAAE,OAAO,CAAA;KAAE,GAAG,OAAO,CAAC,MAAM,CAAC;IAwB7G,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC;IAavB,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAUxB,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC;IA0BhC,WAAW,IAAI,MAAM;IAIrB,OAAO,IAAI,SAAS,GAAG,SAAS,GAAG,iBAAiB,GAAG,QAAQ,GAAG,QAAQ;YAI5D,gBAAgB;YAShB,UAAU;IAqBxB,OAAO,CAAC,wBAAwB;YAyElB,iBAAiB;CAoChC"}
|
|
@@ -166,7 +166,7 @@ class PodmanDaemonManager {
|
|
|
166
166
|
};
|
|
167
167
|
}
|
|
168
168
|
}
|
|
169
|
-
async logs(follow, lines = 100) {
|
|
169
|
+
async logs(follow, lines = 100, options) {
|
|
170
170
|
if (follow) {
|
|
171
171
|
const { spawn } = require('child_process');
|
|
172
172
|
const proc = spawn('podman', ['logs', this.containerName, '--tail', String(lines), '-f'], {
|
|
@@ -8,7 +8,10 @@ export declare class SystemdDaemonManager implements IDaemonManager {
|
|
|
8
8
|
stop(): Promise<void>;
|
|
9
9
|
restart(): Promise<void>;
|
|
10
10
|
status(): Promise<DaemonStatus>;
|
|
11
|
-
logs(follow: boolean, lines?: number
|
|
11
|
+
logs(follow: boolean, lines?: number, options?: {
|
|
12
|
+
stdout?: boolean;
|
|
13
|
+
stderr?: boolean;
|
|
14
|
+
}): Promise<string>;
|
|
12
15
|
enable(): Promise<void>;
|
|
13
16
|
disable(): Promise<void>;
|
|
14
17
|
uninstall(): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SystemdDaemonManager.d.ts","sourceRoot":"","sources":["../../../src/services/daemon/SystemdDaemonManager.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAM7F,qBAAa,oBAAqB,YAAW,cAAc;IACzD,OAAO,CAAC,WAAW,CAA2B;IAC9C,OAAO,CAAC,eAAe,CAA6D;;IAQ9E,OAAO,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC;IAmB5C,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAQtB,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAQrB,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAQxB,MAAM,IAAI,OAAO,CAAC,YAAY,CAAC;IA0B/B,IAAI,CAAC,MAAM,EAAE,OAAO,EAAE,KAAK,GAAE,MAAY,GAAG,OAAO,CAAC,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"SystemdDaemonManager.d.ts","sourceRoot":"","sources":["../../../src/services/daemon/SystemdDaemonManager.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAM7F,qBAAa,oBAAqB,YAAW,cAAc;IACzD,OAAO,CAAC,WAAW,CAA2B;IAC9C,OAAO,CAAC,eAAe,CAA6D;;IAQ9E,OAAO,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC;IAmB5C,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAQtB,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAQrB,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAQxB,MAAM,IAAI,OAAO,CAAC,YAAY,CAAC;IA0B/B,IAAI,CAAC,MAAM,EAAE,OAAO,EAAE,KAAK,GAAE,MAAY,EAAE,OAAO,CAAC,EAAE;QAAE,MAAM,CAAC,EAAE,OAAO,CAAC;QAAC,MAAM,CAAC,EAAE,OAAO,CAAA;KAAE,GAAG,OAAO,CAAC,MAAM,CAAC;IA6B7G,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC;IAQvB,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAQxB,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC;IAuBhC,WAAW,IAAI,MAAM;IAIrB,OAAO,IAAI,SAAS,GAAG,SAAS,GAAG,iBAAiB,GAAG,QAAQ,GAAG,QAAQ;YAI5D,SAAS;IASvB,OAAO,CAAC,mBAAmB;CAuB5B"}
|
|
@@ -113,7 +113,7 @@ class SystemdDaemonManager {
|
|
|
113
113
|
};
|
|
114
114
|
}
|
|
115
115
|
}
|
|
116
|
-
async logs(follow, lines = 100) {
|
|
116
|
+
async logs(follow, lines = 100, options) {
|
|
117
117
|
const followFlag = follow ? '-f' : '';
|
|
118
118
|
const command = `journalctl -u ${this.serviceName} -n ${lines} ${followFlag}`;
|
|
119
119
|
if (follow) {
|
|
@@ -9,7 +9,10 @@ export declare class WindowsServiceDaemonManager implements IDaemonManager {
|
|
|
9
9
|
stop(): Promise<void>;
|
|
10
10
|
restart(): Promise<void>;
|
|
11
11
|
status(): Promise<DaemonStatus>;
|
|
12
|
-
logs(follow: boolean, lines?: number
|
|
12
|
+
logs(follow: boolean, lines?: number, options?: {
|
|
13
|
+
stdout?: boolean;
|
|
14
|
+
stderr?: boolean;
|
|
15
|
+
}): Promise<string>;
|
|
13
16
|
enable(): Promise<void>;
|
|
14
17
|
disable(): Promise<void>;
|
|
15
18
|
uninstall(): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WindowsServiceDaemonManager.d.ts","sourceRoot":"","sources":["../../../src/services/daemon/WindowsServiceDaemonManager.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;
|
|
1
|
+
{"version":3,"file":"WindowsServiceDaemonManager.d.ts","sourceRoot":"","sources":["../../../src/services/daemon/WindowsServiceDaemonManager.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAM7F,qBAAa,2BAA4B,YAAW,cAAc;IAChE,OAAO,CAAC,WAAW,CAA0B;IAC7C,OAAO,CAAC,WAAW,CAA2B;IAC9C,OAAO,CAAC,WAAW,CAAwE;;IAQrF,OAAO,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC;IAoC5C,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAUtB,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAUrB,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAKxB,MAAM,IAAI,OAAO,CAAC,YAAY,CAAC;IA2B/B,IAAI,CAAC,MAAM,EAAE,OAAO,EAAE,KAAK,GAAE,MAAY,EAAE,OAAO,CAAC,EAAE;QAAE,MAAM,CAAC,EAAE,OAAO,CAAC;QAAC,MAAM,CAAC,EAAE,OAAO,CAAA;KAAE,GAAG,OAAO,CAAC,MAAM,CAAC;IA4C7G,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC;IAQvB,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAQxB,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC;IAgBhC,WAAW,IAAI,MAAM;IAIrB,OAAO,IAAI,SAAS,GAAG,SAAS,GAAG,iBAAiB,GAAG,QAAQ,GAAG,QAAQ;CAG3E"}
|
|
@@ -39,6 +39,7 @@ const util_1 = require("util");
|
|
|
39
39
|
const fs = __importStar(require("fs/promises"));
|
|
40
40
|
const path = __importStar(require("path"));
|
|
41
41
|
const PlatformDetector_1 = require("../../utils/PlatformDetector");
|
|
42
|
+
const PathResolver_1 = require("../../utils/PathResolver");
|
|
42
43
|
const execAsync = (0, util_1.promisify)(child_process_1.exec);
|
|
43
44
|
class WindowsServiceDaemonManager {
|
|
44
45
|
constructor() {
|
|
@@ -128,10 +129,10 @@ class WindowsServiceDaemonManager {
|
|
|
128
129
|
};
|
|
129
130
|
}
|
|
130
131
|
}
|
|
131
|
-
async logs(follow, lines = 100) {
|
|
132
|
+
async logs(follow, lines = 100, options) {
|
|
132
133
|
// Windows Event Log integration would be more complex
|
|
133
134
|
// For now, we'll try to read from a log file if the agent writes one
|
|
134
|
-
const logPath =
|
|
135
|
+
const logPath = PathResolver_1.PathResolver.resolveAgentLogPath('windows-service');
|
|
135
136
|
try {
|
|
136
137
|
if (follow) {
|
|
137
138
|
console.log('Following logs (press Ctrl+C to stop)...');
|
|
@@ -72,5 +72,19 @@ export declare class PathResolver {
|
|
|
72
72
|
* @returns The appropriate agent config file path
|
|
73
73
|
*/
|
|
74
74
|
static resolveAgentConfigFilePath(installationType?: string): string;
|
|
75
|
+
/**
|
|
76
|
+
* Get the agent log file path.
|
|
77
|
+
*
|
|
78
|
+
* @param useSystemPath - If true, use system path; otherwise use user path
|
|
79
|
+
* @returns The agent.log file path
|
|
80
|
+
*/
|
|
81
|
+
static getAgentLogPath(useSystemPath?: boolean): string;
|
|
82
|
+
/**
|
|
83
|
+
* Resolve the agent log file path based on installation type.
|
|
84
|
+
*
|
|
85
|
+
* @param installationType - The agent installation type
|
|
86
|
+
* @returns The appropriate agent log file path
|
|
87
|
+
*/
|
|
88
|
+
static resolveAgentLogPath(installationType?: string): string;
|
|
75
89
|
}
|
|
76
90
|
//# sourceMappingURL=PathResolver.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PathResolver.d.ts","sourceRoot":"","sources":["../../src/utils/PathResolver.ts"],"names":[],"mappings":"AAGA;;;;;GAKG;AACH,qBAAa,YAAY;IACvB;;;;;OAKG;IACH,MAAM,CAAC,eAAe,IAAI,MAAM;IAkDhC;;;;;OAKG;IACH,MAAM,CAAC,eAAe,IAAI,MAAM;IAyBhC;;;;;OAKG;IACH,MAAM,CAAC,iBAAiB,IAAI,MAAM;IAmBlC;;;;;;;OAOG;IACH,MAAM,CAAC,kBAAkB,CAAC,aAAa,GAAE,OAAe,GAAG,MAAM;IAKjE;;;;OAIG;IACH,MAAM,CAAC,gBAAgB,IAAI,MAAM;IAKjC;;;;;OAKG;IACH,MAAM,CAAC,sBAAsB,CAAC,aAAa,GAAE,OAAe,GAAG,MAAM;IAKrE;;;;;OAKG;IACH,MAAM,CAAC,kBAAkB,CAAC,aAAa,GAAE,OAAe,GAAG,MAAM;IAKjE;;;;;;;;OAQG;IACH,MAAM,CAAC,sBAAsB,CAAC,gBAAgB,CAAC,EAAE,MAAM,GAAG,MAAM;IAShE;;;;;OAKG;IACH,MAAM,CAAC,0BAA0B,CAAC,gBAAgB,CAAC,EAAE,MAAM,GAAG,MAAM;
|
|
1
|
+
{"version":3,"file":"PathResolver.d.ts","sourceRoot":"","sources":["../../src/utils/PathResolver.ts"],"names":[],"mappings":"AAGA;;;;;GAKG;AACH,qBAAa,YAAY;IACvB;;;;;OAKG;IACH,MAAM,CAAC,eAAe,IAAI,MAAM;IAkDhC;;;;;OAKG;IACH,MAAM,CAAC,eAAe,IAAI,MAAM;IAyBhC;;;;;OAKG;IACH,MAAM,CAAC,iBAAiB,IAAI,MAAM;IAmBlC;;;;;;;OAOG;IACH,MAAM,CAAC,kBAAkB,CAAC,aAAa,GAAE,OAAe,GAAG,MAAM;IAKjE;;;;OAIG;IACH,MAAM,CAAC,gBAAgB,IAAI,MAAM;IAKjC;;;;;OAKG;IACH,MAAM,CAAC,sBAAsB,CAAC,aAAa,GAAE,OAAe,GAAG,MAAM;IAKrE;;;;;OAKG;IACH,MAAM,CAAC,kBAAkB,CAAC,aAAa,GAAE,OAAe,GAAG,MAAM;IAKjE;;;;;;;;OAQG;IACH,MAAM,CAAC,sBAAsB,CAAC,gBAAgB,CAAC,EAAE,MAAM,GAAG,MAAM;IAShE;;;;;OAKG;IACH,MAAM,CAAC,0BAA0B,CAAC,gBAAgB,CAAC,EAAE,MAAM,GAAG,MAAM;IASpE;;;;;OAKG;IACH,MAAM,CAAC,eAAe,CAAC,aAAa,GAAE,OAAe,GAAG,MAAM;IAK9D;;;;;OAKG;IACH,MAAM,CAAC,mBAAmB,CAAC,gBAAgB,CAAC,EAAE,MAAM,GAAG,MAAM;CAQ9D"}
|
|
@@ -230,6 +230,30 @@ class PathResolver {
|
|
|
230
230
|
installationType === 'podman';
|
|
231
231
|
return this.getAgentConfigFilePath(useSystemPath);
|
|
232
232
|
}
|
|
233
|
+
/**
|
|
234
|
+
* Get the agent log file path.
|
|
235
|
+
*
|
|
236
|
+
* @param useSystemPath - If true, use system path; otherwise use user path
|
|
237
|
+
* @returns The agent.log file path
|
|
238
|
+
*/
|
|
239
|
+
static getAgentLogPath(useSystemPath = false) {
|
|
240
|
+
const agentConfigPath = this.getAgentConfigPath(useSystemPath);
|
|
241
|
+
return path.join(agentConfigPath, 'logs', 'agent.log');
|
|
242
|
+
}
|
|
243
|
+
/**
|
|
244
|
+
* Resolve the agent log file path based on installation type.
|
|
245
|
+
*
|
|
246
|
+
* @param installationType - The agent installation type
|
|
247
|
+
* @returns The appropriate agent log file path
|
|
248
|
+
*/
|
|
249
|
+
static resolveAgentLogPath(installationType) {
|
|
250
|
+
const useSystemPath = installationType === 'systemd' ||
|
|
251
|
+
installationType === 'launchd' ||
|
|
252
|
+
installationType === 'windows-service' ||
|
|
253
|
+
installationType === 'docker' ||
|
|
254
|
+
installationType === 'podman';
|
|
255
|
+
return this.getAgentLogPath(useSystemPath);
|
|
256
|
+
}
|
|
233
257
|
}
|
|
234
258
|
exports.PathResolver = PathResolver;
|
|
235
259
|
//# sourceMappingURL=PathResolver.js.map
|