@vantageos/backend-doctor 0.1.0
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/README.md +88 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +94 -0
- package/dist/contract.d.ts +18 -0
- package/dist/contract.js +29 -0
- package/dist/coverage-cli.d.ts +2 -0
- package/dist/coverage-cli.js +17 -0
- package/dist/coverage.d.ts +32 -0
- package/dist/coverage.js +77 -0
- package/dist/detectors/oracle-axis1.d.ts +86 -0
- package/dist/detectors/oracle-axis1.js +221 -0
- package/dist/detectors/oracle-axis2.d.ts +22 -0
- package/dist/detectors/oracle-axis2.js +149 -0
- package/dist/detectors/predicates.d.ts +19 -0
- package/dist/detectors/predicates.js +334 -0
- package/dist/detectors/shared.d.ts +56 -0
- package/dist/detectors/shared.js +103 -0
- package/dist/detectors/source/_scan.d.ts +43 -0
- package/dist/detectors/source/_scan.js +82 -0
- package/dist/detectors/source/backfill.d.ts +27 -0
- package/dist/detectors/source/backfill.js +211 -0
- package/dist/detectors/source/contract.d.ts +33 -0
- package/dist/detectors/source/contract.js +385 -0
- package/dist/detectors/source/identity.d.ts +47 -0
- package/dist/detectors/source/identity.js +410 -0
- package/dist/detectors/source/jobs.d.ts +10 -0
- package/dist/detectors/source/jobs.js +209 -0
- package/dist/detectors/source/lifecycle.d.ts +6 -0
- package/dist/detectors/source/lifecycle.js +147 -0
- package/dist/detectors/source/readbudget.d.ts +6 -0
- package/dist/detectors/source/readbudget.js +133 -0
- package/dist/detectors/source/refusal.d.ts +6 -0
- package/dist/detectors/source/refusal.js +125 -0
- package/dist/detectors/source/security.d.ts +37 -0
- package/dist/detectors/source/security.js +392 -0
- package/dist/detectors/source/writesafety.d.ts +14 -0
- package/dist/detectors/source/writesafety.js +345 -0
- package/dist/detectors/standard/_doc.d.ts +66 -0
- package/dist/detectors/standard/_doc.js +152 -0
- package/dist/detectors/standard/r41-frontier.d.ts +58 -0
- package/dist/detectors/standard/r41-frontier.js +176 -0
- package/dist/detectors/standard/r46-returns-validator.d.ts +61 -0
- package/dist/detectors/standard/r46-returns-validator.js +474 -0
- package/dist/detectors/standard/standard-doc.d.ts +12 -0
- package/dist/detectors/standard/standard-doc.js +271 -0
- package/dist/detectors/structural.d.ts +14 -0
- package/dist/detectors/structural.js +83 -0
- package/dist/engine-types.d.ts +10 -0
- package/dist/engine-types.js +1 -0
- package/dist/not-checkable.d.ts +22 -0
- package/dist/not-checkable.js +37 -0
- package/dist/oracle.d.ts +33 -0
- package/dist/oracle.js +133 -0
- package/dist/registry.d.ts +11 -0
- package/dist/registry.js +140 -0
- package/dist/report.d.ts +35 -0
- package/dist/report.js +138 -0
- package/dist/severity.d.ts +30 -0
- package/dist/severity.js +121 -0
- package/dist/tally.d.ts +57 -0
- package/dist/tally.js +152 -0
- package/dist/trigger.d.ts +47 -0
- package/dist/trigger.js +143 -0
- package/fixtures/backend-standard-51ec7af1.md +648 -0
- package/fixtures/backend-standard-a9d7877b.md +629 -0
- package/fixtures/mcp-app-standard-a74a042b.md +279 -0
- package/fixtures/mcp-extension-standard-a74a042b.md +259 -0
- package/fixtures/mcp-server-standard-a74a042b.md +434 -0
- package/fixtures/mcp-standard-a74a042b.md +354 -0
- package/fixtures/vp-1200-green/.pin +1 -0
- package/fixtures/vp-1200-green/convex/migrations.ts +350 -0
- package/fixtures/vp-1200-green/convex/schema.ts +1243 -0
- package/fixtures/vp-1200-red/.pin +1 -0
- package/fixtures/vp-1200-red/convex/migrations.ts +239 -0
- package/fixtures/vp-1200-red/convex/schema.ts +1243 -0
- package/fixtures/vp-by-tool-day158.csv +190 -0
- package/fixtures/vp-convex/.github/workflows/npm-publish.yml +163 -0
- package/fixtures/vp-convex/.pin +1 -0
- package/fixtures/vp-convex/bun.lock +783 -0
- package/fixtures/vp-convex/convex/auth.config.ts +8 -0
- package/fixtures/vp-convex/convex/briefingNotes.ts +321 -0
- package/fixtures/vp-convex/convex/convex.config.ts +14 -0
- package/fixtures/vp-convex/convex/credentials.ts +591 -0
- package/fixtures/vp-convex/convex/crons.ts +72 -0
- package/fixtures/vp-convex/convex/dashboard.ts +199 -0
- package/fixtures/vp-convex/convex/gumroadWebhook.ts +815 -0
- package/fixtures/vp-convex/convex/issues.ts +544 -0
- package/fixtures/vp-convex/convex/kb.ts +305 -0
- package/fixtures/vp-convex/convex/kbMutations.ts +192 -0
- package/fixtures/vp-convex/convex/kbShared.ts +56 -0
- package/fixtures/vp-convex/convex/licenses.ts +443 -0
- package/fixtures/vp-convex/convex/memories.ts +406 -0
- package/fixtures/vp-convex/convex/memoriesScoped.ts +220 -0
- package/fixtures/vp-convex/convex/messages.ts +971 -0
- package/fixtures/vp-convex/convex/migrations.ts +239 -0
- package/fixtures/vp-convex/convex/missionTemplates.ts +369 -0
- package/fixtures/vp-convex/convex/oauth.ts +1608 -0
- package/fixtures/vp-convex/convex/oauthMigrations.ts +96 -0
- package/fixtures/vp-convex/convex/okfBundleNode.ts +1031 -0
- package/fixtures/vp-convex/convex/recurringTasks.ts +386 -0
- package/fixtures/vp-convex/convex/schema.ts +1229 -0
- package/fixtures/vp-convex/convex/tasks.ts +2782 -0
- package/fixtures/vp-r31-green/.pin +1 -0
- package/fixtures/vp-r31-green/convex/migrations.ts +350 -0
- package/fixtures/vp-r31-red/.pin +1 -0
- package/fixtures/vp-r31-red/convex/migrations.ts +286 -0
- package/fixtures/vr-by-tool-day159.csv +89 -0
- package/package.json +39 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
7c5e3ab4c1697c6f5be694408c45afc8fa7153fb
|
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
import { internalMutation } from "./_generated/server";
|
|
2
|
+
|
|
3
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
4
|
+
// Migration: backfill startedAt + completedAt on tasks
|
|
5
|
+
// Run: npx convex run migrations:backfillTaskTimes
|
|
6
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
7
|
+
|
|
8
|
+
export const backfillTaskTimes = internalMutation({
|
|
9
|
+
args: {},
|
|
10
|
+
handler: async (ctx) => {
|
|
11
|
+
const tasks = await ctx.db.query("tasks").collect();
|
|
12
|
+
let startedFixed = 0;
|
|
13
|
+
let completedFixed = 0;
|
|
14
|
+
|
|
15
|
+
for (const task of tasks) {
|
|
16
|
+
const patch: Record<string, any> = {};
|
|
17
|
+
|
|
18
|
+
// Backfill startedAt for in_progress/done/review tasks
|
|
19
|
+
if (
|
|
20
|
+
!task.startedAt &&
|
|
21
|
+
(task.status === "in_progress" || task.status === "done" || task.status === "review")
|
|
22
|
+
) {
|
|
23
|
+
patch.startedAt = task.createdAt;
|
|
24
|
+
startedFixed++;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
// Backfill completedAt for done tasks
|
|
28
|
+
if (!task.completedAt && task.status === "done") {
|
|
29
|
+
patch.completedAt = task.updatedAt;
|
|
30
|
+
completedFixed++;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// Calculate actualMinutes if both timestamps exist
|
|
34
|
+
const startedAt = patch.startedAt ?? task.startedAt;
|
|
35
|
+
const completedAt = patch.completedAt ?? task.completedAt;
|
|
36
|
+
if (startedAt && completedAt && !task.actualMinutes) {
|
|
37
|
+
patch.actualMinutes = Math.round((completedAt - startedAt) / 60_000);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
if (Object.keys(patch).length > 0) {
|
|
41
|
+
await ctx.db.patch(task._id, patch);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
console.log(`Backfilled: ${startedFixed} startedAt, ${completedFixed} completedAt`);
|
|
46
|
+
return { startedFixed, completedFixed, total: tasks.length };
|
|
47
|
+
},
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
51
|
+
// Cleanup: delete test briefing notes (MCP Test Briefing entries)
|
|
52
|
+
// Run: npx convex run migrations:deleteTestBriefings
|
|
53
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
54
|
+
|
|
55
|
+
export const deleteTestBriefings = internalMutation({
|
|
56
|
+
args: {},
|
|
57
|
+
handler: async (ctx) => {
|
|
58
|
+
const notes = await ctx.db.query("briefingNotes").collect();
|
|
59
|
+
let deleted = 0;
|
|
60
|
+
|
|
61
|
+
for (const note of notes) {
|
|
62
|
+
if (note.title === "MCP Test Briefing") {
|
|
63
|
+
await ctx.db.delete(note._id);
|
|
64
|
+
deleted++;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
console.log(`Deleted ${deleted} test briefing notes`);
|
|
69
|
+
return { deleted };
|
|
70
|
+
},
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
74
|
+
// Cleanup: delete test tasks created by MCP tester
|
|
75
|
+
// Run: npx convex run migrations:deleteTestTasks
|
|
76
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
77
|
+
|
|
78
|
+
export const deleteTestTasks = internalMutation({
|
|
79
|
+
args: {},
|
|
80
|
+
handler: async (ctx) => {
|
|
81
|
+
const tasks = await ctx.db.query("tasks").collect();
|
|
82
|
+
let deleted = 0;
|
|
83
|
+
|
|
84
|
+
for (const task of tasks) {
|
|
85
|
+
if (
|
|
86
|
+
task.title === "Test task from MCP tester" ||
|
|
87
|
+
task.title === "Mission-linked task from MCP tester"
|
|
88
|
+
) {
|
|
89
|
+
await ctx.db.delete(task._id);
|
|
90
|
+
deleted++;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
console.log(`Deleted ${deleted} test tasks`);
|
|
95
|
+
return { deleted };
|
|
96
|
+
},
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
100
|
+
// Cleanup: delete test missions created by MCP tester
|
|
101
|
+
// Run: npx convex run migrations:deleteTestMissions
|
|
102
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
103
|
+
|
|
104
|
+
export const deleteTestMissions = internalMutation({
|
|
105
|
+
args: {},
|
|
106
|
+
handler: async (ctx) => {
|
|
107
|
+
const missions = await ctx.db.query("missions").collect();
|
|
108
|
+
let deleted = 0;
|
|
109
|
+
|
|
110
|
+
for (const mission of missions) {
|
|
111
|
+
if (
|
|
112
|
+
mission.name === "Test mission from MCP tester" ||
|
|
113
|
+
mission.name === "Updated test mission"
|
|
114
|
+
) {
|
|
115
|
+
await ctx.db.delete(mission._id);
|
|
116
|
+
deleted++;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
console.log(`Deleted ${deleted} test missions`);
|
|
121
|
+
return { deleted };
|
|
122
|
+
},
|
|
123
|
+
});
|
|
124
|
+
|
|
125
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
126
|
+
// Cleanup: delete test memories from test/mcp-tester namespace
|
|
127
|
+
// Run: npx convex run migrations:deleteTestMemories
|
|
128
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
129
|
+
|
|
130
|
+
export const deleteTestMemories = internalMutation({
|
|
131
|
+
args: {},
|
|
132
|
+
handler: async (ctx) => {
|
|
133
|
+
const memories = await ctx.db
|
|
134
|
+
.query("memories")
|
|
135
|
+
.withIndex("by_namespace", (q) => q.eq("namespace", "test/mcp-tester"))
|
|
136
|
+
.collect();
|
|
137
|
+
let deleted = 0;
|
|
138
|
+
|
|
139
|
+
for (const mem of memories) {
|
|
140
|
+
await ctx.db.delete(mem._id);
|
|
141
|
+
deleted++;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
console.log(`Deleted ${deleted} test memories from test/mcp-tester`);
|
|
145
|
+
return { deleted };
|
|
146
|
+
},
|
|
147
|
+
});
|
|
148
|
+
|
|
149
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
150
|
+
// Cleanup: delete test messages from MCP tester
|
|
151
|
+
// Run: npx convex run migrations:deleteTestMessages
|
|
152
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
153
|
+
|
|
154
|
+
export const deleteTestMessages = internalMutation({
|
|
155
|
+
args: {},
|
|
156
|
+
handler: async (ctx) => {
|
|
157
|
+
const messages = await ctx.db.query("messages").collect();
|
|
158
|
+
let deleted = 0;
|
|
159
|
+
|
|
160
|
+
for (const msg of messages) {
|
|
161
|
+
if (msg.content === "Test message from MCP tester") {
|
|
162
|
+
// Delete receipts first
|
|
163
|
+
const receipts = await ctx.db
|
|
164
|
+
.query("messageReceipts")
|
|
165
|
+
.withIndex("by_message", (q) => q.eq("messageId", msg._id))
|
|
166
|
+
.collect();
|
|
167
|
+
for (const receipt of receipts) {
|
|
168
|
+
await ctx.db.delete(receipt._id);
|
|
169
|
+
}
|
|
170
|
+
await ctx.db.delete(msg._id);
|
|
171
|
+
deleted++;
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
console.log(`Deleted ${deleted} test messages and their receipts`);
|
|
176
|
+
return { deleted };
|
|
177
|
+
},
|
|
178
|
+
});
|
|
179
|
+
|
|
180
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
181
|
+
// Migration: rename memory namespace "orchestrator/pi" → "orchestrator/sigma"
|
|
182
|
+
// Run: npx convex run migrations:migrateMemoriesNamespace
|
|
183
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
184
|
+
|
|
185
|
+
export const migrateMemoriesNamespace = internalMutation({
|
|
186
|
+
args: {},
|
|
187
|
+
handler: async (ctx) => {
|
|
188
|
+
const memories = await ctx.db
|
|
189
|
+
.query("memories")
|
|
190
|
+
.withIndex("by_namespace", (q) => q.eq("namespace", "orchestrator/pi"))
|
|
191
|
+
.collect();
|
|
192
|
+
let migrated = 0;
|
|
193
|
+
|
|
194
|
+
for (const mem of memories) {
|
|
195
|
+
await ctx.db.patch(mem._id, { namespace: "orchestrator/sigma" });
|
|
196
|
+
migrated++;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
console.log(`Migrated ${migrated} memories from orchestrator/pi to orchestrator/sigma`);
|
|
200
|
+
return { migrated };
|
|
201
|
+
},
|
|
202
|
+
});
|
|
203
|
+
|
|
204
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
205
|
+
// Migration: change diary orchestrator "pi" → "sigma" for VPS entries
|
|
206
|
+
// Run: npx convex run migrations:migrateDiaryOrchestrator
|
|
207
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
208
|
+
|
|
209
|
+
export const migrateDiaryOrchestrator = internalMutation({
|
|
210
|
+
args: {},
|
|
211
|
+
handler: async (ctx) => {
|
|
212
|
+
const entries = await ctx.db
|
|
213
|
+
.query("diary")
|
|
214
|
+
.withIndex("by_orchestrator_date", (q) => q.eq("orchestrator", "pi"))
|
|
215
|
+
.collect();
|
|
216
|
+
let migrated = 0;
|
|
217
|
+
let skipped = 0;
|
|
218
|
+
|
|
219
|
+
for (const entry of entries) {
|
|
220
|
+
const content = entry.content.toLowerCase();
|
|
221
|
+
const isVpsRelated =
|
|
222
|
+
content.includes("pi-vps") ||
|
|
223
|
+
content.includes("sigma") ||
|
|
224
|
+
content.includes("vps");
|
|
225
|
+
|
|
226
|
+
if (isVpsRelated) {
|
|
227
|
+
await ctx.db.patch(entry._id, { orchestrator: "sigma" });
|
|
228
|
+
migrated++;
|
|
229
|
+
} else {
|
|
230
|
+
skipped++;
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
console.log(
|
|
235
|
+
`Diary migration: ${migrated} migrated to sigma, ${skipped} kept as pi`
|
|
236
|
+
);
|
|
237
|
+
return { migrated, skipped };
|
|
238
|
+
},
|
|
239
|
+
});
|