@mycadet/credential-executor 0.13.0-dev.202610312329.a740c1c → 0.13.0-dev.202611011818.51165c0
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/Dockerfile +1 -0
- package/eslint.config.mjs +8 -0
- package/knip.json +1 -0
- package/package.json +2 -1
- package/src/logger.ts +3 -10
- package/src/main.ts +28 -6
package/Dockerfile
CHANGED
|
@@ -23,6 +23,7 @@ COPY --parents clients/*/package.json ./
|
|
|
23
23
|
COPY cli/package.json ./cli/
|
|
24
24
|
COPY gateway/package.json ./gateway/
|
|
25
25
|
COPY credential-executor/package.json ./credential-executor/
|
|
26
|
+
COPY qa/package.json ./qa/
|
|
26
27
|
COPY assistant/package.json ./assistant/
|
|
27
28
|
COPY assistant/src/api/package.json ./assistant/src/api/
|
|
28
29
|
COPY --parents packages/*/package.json ./
|
package/eslint.config.mjs
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { defineConfig, globalIgnores } from "eslint/config";
|
|
2
2
|
import tseslint from "typescript-eslint";
|
|
3
|
+
import { noReExports } from "@mycadet/shared/eslint/no-re-exports";
|
|
3
4
|
|
|
4
5
|
const eslintConfig = defineConfig([
|
|
5
6
|
...tseslint.configs.recommended,
|
|
@@ -18,6 +19,13 @@ const eslintConfig = defineConfig([
|
|
|
18
19
|
"@typescript-eslint/no-explicit-any": "off",
|
|
19
20
|
},
|
|
20
21
|
},
|
|
22
|
+
{
|
|
23
|
+
// Re-export shims are outlawed: consumers import from the defining
|
|
24
|
+
// module, and only index files aggregate a public surface. Warning
|
|
25
|
+
// level with a pinned count — each PR chips away at the remainder.
|
|
26
|
+
plugins: { "@mycadet": { rules: { "no-re-exports": noReExports } } },
|
|
27
|
+
rules: { "@mycadet/no-re-exports": "error" },
|
|
28
|
+
},
|
|
21
29
|
]);
|
|
22
30
|
|
|
23
31
|
export default eslintConfig;
|
package/knip.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mycadet/credential-executor",
|
|
3
|
-
"version": "0.13.0-dev.
|
|
3
|
+
"version": "0.13.0-dev.202611011818.51165c0",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/vargasjr-dev/mycadet-temp.git"
|
|
@@ -36,6 +36,7 @@
|
|
|
36
36
|
"@mycadet/ipc-server-utils"
|
|
37
37
|
],
|
|
38
38
|
"devDependencies": {
|
|
39
|
+
"@mycadet/shared": "0.0.1",
|
|
39
40
|
"@types/bun": "1.3.10",
|
|
40
41
|
"eslint": "10.1.0",
|
|
41
42
|
"knip": "5.88.1",
|
package/src/logger.ts
CHANGED
|
@@ -107,18 +107,11 @@ function ensureCurrentDate(): void {
|
|
|
107
107
|
|
|
108
108
|
export function initLogger(config: LogFileConfig): void {
|
|
109
109
|
rootLogger = buildLogger(config);
|
|
110
|
-
|
|
111
|
-
if (config.dir && config.retentionDays > 0) {
|
|
112
|
-
const removed = pruneOldLogFiles(config.dir, config.retentionDays);
|
|
113
|
-
if (removed > 0) {
|
|
114
|
-
rootLogger.info(
|
|
115
|
-
{ removed, retentionDays: config.retentionDays },
|
|
116
|
-
"Pruned old log files",
|
|
117
|
-
);
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
110
|
}
|
|
121
111
|
|
|
112
|
+
/** How often the main process's background log-retention sweep runs. */
|
|
113
|
+
export const LOG_RETENTION_SWEEP_INTERVAL_MS = 60 * 60 * 1000;
|
|
114
|
+
|
|
122
115
|
/**
|
|
123
116
|
* Returns a lazy proxy logger that always delegates to the **current**
|
|
124
117
|
* rootLogger. This is critical because module-level `const log = getLogger(...)`
|
package/src/main.ts
CHANGED
|
@@ -29,7 +29,12 @@ import {
|
|
|
29
29
|
} from "@mycadet/ipc-server-utils";
|
|
30
30
|
|
|
31
31
|
import { createLocalSecureKeyBackend } from "./materializers/local-secure-key-backend.js";
|
|
32
|
-
import {
|
|
32
|
+
import {
|
|
33
|
+
getLogger,
|
|
34
|
+
initLogger,
|
|
35
|
+
LOG_RETENTION_SWEEP_INTERVAL_MS,
|
|
36
|
+
pruneOldLogFiles,
|
|
37
|
+
} from "./logger.js";
|
|
33
38
|
import {
|
|
34
39
|
getBootstrapSocketPath,
|
|
35
40
|
getCesDataRoot,
|
|
@@ -326,6 +331,27 @@ async function main(): Promise<void> {
|
|
|
326
331
|
ensureDataDirs();
|
|
327
332
|
|
|
328
333
|
initLogger({ dir: getCesLogDir(), retentionDays: 30 });
|
|
334
|
+
startLogRetentionSweep();
|
|
335
|
+
|
|
336
|
+
/**
|
|
337
|
+
* Background log-retention sweep (field feedback item 8): the prune left
|
|
338
|
+
* initLogger's critical path. This process is short-lived — the interval is
|
|
339
|
+
* unref'd so it never blocks exit; it simply prunes opportunistically while
|
|
340
|
+
* the process is alive.
|
|
341
|
+
*/
|
|
342
|
+
function startLogRetentionSweep(): void {
|
|
343
|
+
const interval = setInterval(() => {
|
|
344
|
+
try {
|
|
345
|
+
const removed = pruneOldLogFiles(getCesLogDir(), 30);
|
|
346
|
+
if (removed > 0) {
|
|
347
|
+
log.info({ removed }, "Pruned old CES log files");
|
|
348
|
+
}
|
|
349
|
+
} catch (err) {
|
|
350
|
+
log.warn({ err }, "CES log retention sweep failed");
|
|
351
|
+
}
|
|
352
|
+
}, LOG_RETENTION_SWEEP_INTERVAL_MS);
|
|
353
|
+
interval.unref();
|
|
354
|
+
}
|
|
329
355
|
|
|
330
356
|
log.info(`Starting CES v${CES_PROTOCOL_VERSION} (socket transport)`);
|
|
331
357
|
|
|
@@ -344,11 +370,7 @@ async function main(): Promise<void> {
|
|
|
344
370
|
// cwd fallback convention) — see paths.ts.
|
|
345
371
|
const secureKeyBackend = createLocalSecureKeyBackend(getSecurityDir());
|
|
346
372
|
|
|
347
|
-
await runCesMigrations(
|
|
348
|
-
getCesDataRoot(),
|
|
349
|
-
secureKeyBackend,
|
|
350
|
-
CES_MIGRATIONS,
|
|
351
|
-
);
|
|
373
|
+
await runCesMigrations(getCesDataRoot(), secureKeyBackend, CES_MIGRATIONS);
|
|
352
374
|
log.info("CES startup: migrations complete");
|
|
353
375
|
|
|
354
376
|
initMetadataStore(getCesDataRoot());
|