Codemod db pass-through calls to domain modules: tasks + agents (C1 part 1/3)
Rewrite ~525 call sites from `db.<method>()` to `db.<module>.<method>()` for tasks and agents domains (including `getAgent`/`findAgent`/`getTask` which live on the `entityCrud` field). Delete the corresponding pass-through methods on AppDatabaseBase. Structural types that narrowed `db` to a bag of flat methods (CapabilityMatchDb, EscalationDeps, SweepStaleReviewsDeps) are reshaped to match the new namespace. Internal callback references inside database.ts/database-base.ts now invoke the owning module directly (e.g. `this.agents.saveAgent`) rather than the deleted pass-through. The codemod lives at scripts/codemod/remove-appdatabase-passthrough.mjs and filters by owning module + optional explicit method list. It is idempotent and does not re-rewrite already-namespaced calls.
This commit is contained in:
1 parent
411294afa6
commit
5e9b7acbc6
95 files changed
+1123
-793
No files matched your search
@@ -55,7 +55,7 @@ function createTestWorkspace(db: AppDatabase, companyId: string): string {
|
||||
}
|
||||
|
||||
function createTestAgent(db: AppDatabase, companyId: string, workspaceId: string, name = "Agent"): string {
|
||||
return db.saveAgent({
|
||||
return db.agents.saveAgent({
|
||||
companyId,
|
||||
name,
|
||||
role: "IC",
|
||||
@@ -76,7 +76,7 @@ function createTestTask(
|
||||
agentId: string,
|
||||
workspaceId: string,
|
||||
): string {
|
||||
return db.saveTask({
|
||||
return db.tasks.saveTask({
|
||||
companyId,
|
||||
title: "Phase helper task",
|
||||
description: "dual-write seed",
|
||||
|
||||
Reference in new issue
Block a user