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
@@ -14,7 +14,7 @@ describe("Step 8: Wake reason injection", () => {
|
||||
it("includes wake reason section for non-timer triggers", () => {
|
||||
const agentId = createAgent({ name: "CTO", role: "CTO" });
|
||||
const ceoId = createAgent({ name: "CEO", role: "CEO" });
|
||||
const ceo = shared.db.getAgent(ceoId);
|
||||
const ceo = shared.db.entityCrud.getAgent(ceoId);
|
||||
|
||||
const ctx = buildCtx({
|
||||
agentId,
|
||||
@@ -92,7 +92,7 @@ describe("Step 8: Wake reason injection", () => {
|
||||
|
||||
it("includes wake reason before task description", () => {
|
||||
const agentId = createAgent({ name: "Agent" });
|
||||
const taskId = shared.db.saveTask({
|
||||
const taskId = shared.db.tasks.saveTask({
|
||||
companyId: shared.companyId,
|
||||
title: "Do the thing",
|
||||
description: "Test task",
|
||||
@@ -101,7 +101,7 @@ describe("Step 8: Wake reason injection", () => {
|
||||
priority: "medium",
|
||||
status: "todo",
|
||||
});
|
||||
const task = shared.db.getTask(taskId);
|
||||
const task = shared.db.entityCrud.getTask(taskId);
|
||||
|
||||
const ctx = buildCtx({
|
||||
agentId,
|
||||
|
||||
Reference in new issue
Block a user