refactor: unify duplicate Logger interfaces into single canonical type (#14)

* refactor: unify duplicate Logger interfaces into single canonical type

23 files had local Logger/StoreLogger/PluginLogger/PipelineLogger/RunnerLogger/ExtractorLogger/TriggerLogger
interface definitions with identical shapes ({debug?, info, warn, error}).

Replace all with imports from the canonical `Logger` in `src/core/types.ts`:
- 17 files: local `interface Logger` → `import type { Logger }`
- 6 files: named variants (StoreLogger, PluginLogger, etc.) → `type X = Logger` alias

Two intentionally different interfaces are preserved:
- `CheckpointLogger` (only info + optional warn) — different contract
- `ensure-hook-policy.ts` Logger (no error) — different contract

Net: -120 lines, zero behavioral change.

Signed-off-by: yuanrengu <heyonggang0811@126.com>

* docs: update Logger JSDoc to reflect canonical relationship

StoreLogger, PluginLogger, etc. are now type aliases of Logger, not the
other way around. Update the comment to clarify this inverted relationship.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

---------

Signed-off-by: yuanrengu <heyonggang0811@126.com>
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Andy He
2026-06-01 15:12:46 +08:00
committed by GitHub
parent 438869bec8
commit d1534e488f
24 changed files with 38 additions and 166 deletions
+3 -6
View File
@@ -3,6 +3,8 @@
* Ported from context-offload-plugin with updated runtime defaults.
*/
import type { Logger } from "../core/types.js";
// ============================
// Data types
// ============================
@@ -212,12 +214,7 @@ export interface PluginConfig {
// ============================
/** Logger interface used by offload plugin components */
export interface PluginLogger {
info: (msg: string) => void;
warn: (msg: string) => void;
error: (msg: string) => void;
debug?: (msg: string) => void;
}
export type PluginLogger = Logger;
// ============================
// Plugin defaults