ensemble-review 1.0.35 → 1.0.37
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/dist/api/plugins/rate-limit.js +22 -0
- package/dist/api/routes/releases.js +181 -0
- package/dist/app.js +3 -0
- package/dist/coding/story-build/base-refs.js +10 -2
- package/dist/coding/story-build/loop/driver.js +1 -1
- package/dist/coding/story-build/loop/routes.js +9 -1
- package/dist/coding/story-build/persist.js +53 -7
- package/dist/coding/story-build/plan-persist.js +1 -1
- package/dist/coding/story-build/push-hotfix.js +293 -0
- package/dist/coding/story-build/push.js +5 -0
- package/dist/coding/story-build/routes-build.js +25 -3
- package/dist/db/erase-account.js +14 -0
- package/dist/db/hotfix-bases.js +31 -0
- package/dist/db/migrations/0195_releases.sql +128 -0
- package/dist/db/migrations/0196_story_build_hotfix.sql +54 -0
- package/dist/db/migrations/0197_release_items_live_tag.sql +11 -0
- package/dist/db/migrations/0198_story_build_port_report.sql +7 -0
- package/dist/db/migrations/meta/_journal.json +28 -0
- package/dist/db/queries.js +21 -0
- package/dist/db/release-check.js +378 -0
- package/dist/db/release-settings.js +94 -0
- package/dist/db/repo-tags.js +82 -0
- package/dist/db/schema.sqlite.js +246 -0
- package/dist/github/mutations.js +67 -0
- package/dist/github/queries.js +5 -0
- package/dist/github/settle-query.js +11 -1
- package/dist/github/tag-queries.js +101 -0
- package/dist/releases/create.js +539 -0
- package/dist/releases/github.js +78 -0
- package/dist/releases/notes.js +152 -0
- package/dist/releases/refresh.js +43 -0
- package/dist/sandbox/session/manager.js +207 -12
- package/dist/sandbox/session/plan.js +19 -7
- package/dist/sandbox/session/routes.js +12 -2
- package/dist/sandbox/workspace/hotfix.js +30 -0
- package/dist/sandbox/workspace/index.js +38 -2
- package/dist/sandbox/workspace/port-report.js +137 -0
- package/dist/sandbox/workspace/seed.js +40 -0
- package/dist/shared/hotfix.js +165 -0
- package/dist/shared/index.js +4 -0
- package/dist/shared/release-check.js +528 -0
- package/dist/shared/release-write.js +264 -0
- package/dist/shared/releases.js +89 -0
- package/dist/shared/story-build.js +2 -0
- package/dist/sync/repo-tags.js +368 -0
- package/dist/sync/settle-sweep.js +47 -2
- package/dist/sync/sync-repo.js +12 -0
- package/dist/sync/tag-ranges.js +350 -0
- package/dist/sync/tags-step.js +77 -0
- package/dist/sync/upsert.js +23 -0
- package/package.json +5 -2
- package/public/assets/{AiFixTab-CVIZl9I8.js → AiFixTab-BC3tDZ3z.js} +1 -1
- package/public/assets/{PrBotBehaviourTab-q0M7RU1e.js → PrBotBehaviourTab-C5j5uhLn.js} +1 -1
- package/public/assets/index-BrjUDY3j.js +138 -0
- package/public/assets/index-D1zhsqSF.css +1 -0
- package/public/index.html +2 -2
- package/dist/ai/check-tool.js +0 -6
- package/dist/api/routes/auth.js +0 -194
- package/dist/api/routes/billing.js +0 -209
- package/dist/api/routes/claude-review.js +0 -522
- package/dist/api/routes/contact.js +0 -318
- package/dist/api/routes/feed.js +0 -21
- package/dist/api/routes/inbox.js +0 -45
- package/dist/api/routes/mentions.js +0 -22
- package/dist/api/routes/teams.js +0 -150
- package/dist/api/routes/webhooks.js +0 -181
- package/dist/coding/activity.js +0 -80
- package/dist/coding/agent.js +0 -147
- package/dist/coding/ai-fix/checks-preview.js +0 -58
- package/dist/coding/ai-fix/comment-seed.js +0 -519
- package/dist/coding/ai-fix/prompts.js +0 -283
- package/dist/coding/ai-resolve/prompt.js +0 -161
- package/dist/coding/ai-resolve/routes.js +0 -97
- package/dist/coding/ai-resolve/run.js +0 -343
- package/dist/coding/ai-resolve/schema.js +0 -26
- package/dist/coding/ai-resolve/validate.js +0 -136
- package/dist/coding/checks/deny-scan.js +0 -75
- package/dist/coding/checks/discover.js +0 -541
- package/dist/coding/checks/docker.js +0 -38
- package/dist/coding/checks/env.js +0 -88
- package/dist/coding/checks/hooks.js +0 -91
- package/dist/coding/checks/index.js +0 -8
- package/dist/coding/checks/local.js +0 -40
- package/dist/coding/checks/sandbox.js +0 -206
- package/dist/coding/checks/session.js +0 -518
- package/dist/coding/checks/spawn.js +0 -123
- package/dist/coding/checks/spec.js +0 -140
- package/dist/coding/checks/types.js +0 -6
- package/dist/coding/partial-spend.js +0 -19
- package/dist/coding/safe-path.js +0 -75
- package/dist/coding/story-build/build-prompts.js +0 -178
- package/dist/coding/story-build/build.js +0 -332
- package/dist/coding/story-build/checkouts.js +0 -66
- package/dist/coding/story-build/docs-runner.js +0 -178
- package/dist/coding/story-build/docs.js +0 -334
- package/dist/coding/story-build/manager.js +0 -999
- package/dist/coding/story-build/plan-agent.js +0 -190
- package/dist/coding/story-build/plan.js +0 -338
- package/dist/coding/story-build/prompts.js +0 -147
- package/dist/coding/story-build/routes-docs.js +0 -113
- package/dist/coding/story-build/routes.js +0 -295
- package/dist/coding/story-build/schema.js +0 -53
- package/dist/db/automation-output.js +0 -349
- package/dist/db/credits.js +0 -79
- package/dist/db/schema.js +0 -321
- package/dist/db/schema.pg.js +0 -2197
- package/dist/db/sprint-repo-suggest.js +0 -257
- package/dist/db/sprint-stories.js +0 -42
- package/dist/db/sprint-story.js +0 -505
- package/dist/db/sprint-ticket-repos.js +0 -195
- package/dist/db/story-selection.js +0 -270
- package/dist/db/team-comparison.js +0 -124
- package/dist/db/workspace-comparison.js +0 -98
- package/dist/feed/fyi-provider.js +0 -10
- package/dist/github/local-user.js +0 -92
- package/dist/github/repo-files.js +0 -26
- package/dist/ml/worker.js +0 -31
- package/dist/platform/advisor/discovery/tier2.js +0 -88
- package/dist/platform/advisor/discovery/tier3.js +0 -57
- package/dist/platform/advisor/emitters/adapter.js +0 -5
- package/dist/platform/advisor/emitters/coderabbit.js +0 -175
- package/dist/platform/advisor/emitters/copilot-prose.js +0 -118
- package/dist/platform/advisor/emitters/greptile.js +0 -176
- package/dist/platform/advisor/emitters/lint.js +0 -37
- package/dist/platform/advisor/emitters/manifest.js +0 -239
- package/dist/platform/advisor/emitters/prose.js +0 -183
- package/dist/platform/advisor/emitters/registry.js +0 -20
- package/dist/platform/advisor/emitters/yaml-doc.js +0 -95
- package/dist/platform/advisor/evidence.js +0 -79
- package/dist/platform/advisor/findings.js +0 -15
- package/dist/platform/advisor/intents.js +0 -269
- package/dist/platform/advisor/measure/effect.js +0 -18
- package/dist/platform/advisor/outputs/brief.js +0 -68
- package/dist/platform/advisor/outputs/config-pr.js +0 -156
- package/dist/platform/advisor/refine/diff-guard.js +0 -38
- package/dist/platform/advisor/refine/refine.js +0 -35
- package/dist/platform/advisor/retro-check.js +0 -98
- package/dist/platform/advisor/routes.js +0 -648
- package/dist/platform/advisor/store.js +0 -321
- package/dist/platform/advisor/taxonomy.js +0 -67
- package/dist/platform/annotations/prompts.js +0 -84
- package/dist/platform/annotations/routes.js +0 -86
- package/dist/platform/annotations/runner.js +0 -234
- package/dist/platform/annotations/targets.js +0 -203
- package/dist/platform/insights/grounded-figures.js +0 -162
- package/dist/platform/insights/period-questions.js +0 -235
- package/dist/platform/work-plan/hash.js +0 -99
- package/dist/platform/work-plan/prompt.js +0 -209
- package/dist/platform/work-plan/routes.js +0 -350
- package/dist/pro/bind.js +0 -309
- package/dist/pro/contract.js +0 -36
- package/dist/pro/event-hooks.js +0 -37
- package/dist/pro/migrate.js +0 -64
- package/dist/review/events.js +0 -24
- package/dist/review/local-settings.js +0 -78
- package/dist/review/memory/capture.js +0 -0
- package/dist/review/memory/retrieval.js +0 -272
- package/dist/review/memory/routes.js +0 -78
- package/dist/review/persist.js +0 -203
- package/dist/review/plugin-providers.js +0 -12
- package/dist/review/prompt.js +0 -264
- package/dist/review/review-manager.js +0 -259
- package/dist/review/routing.js +0 -164
- package/dist/review/sprint-assess/agent.js +0 -145
- package/dist/review/sprint-assess/manager.js +0 -382
- package/dist/review/sprint-assess/prompts.js +0 -99
- package/dist/review/sprint-assess/routes.js +0 -109
- package/dist/review/sprint-assess/schema.js +0 -70
- package/dist/review/sprint-assess/validate.js +0 -180
- package/dist/review/sprint-story/manager.js +0 -98
- package/dist/review/sprint-story/prompt.js +0 -45
- package/dist/review/sprint-story/validate.js +0 -127
- package/dist/review/story-docs/build-prompts.js +0 -153
- package/dist/review/story-docs/build-validate.js +0 -162
- package/dist/review/story-report/agent.js +0 -203
- package/dist/review/story-report/fingerprint.js +0 -45
- package/dist/review/story-report/manager.js +0 -287
- package/dist/review/story-report/routes.js +0 -154
- package/dist/review/story-report/story-detail.js +0 -148
- package/dist/review/story-report/validate.js +0 -105
- package/dist/review/ticket-review/sweep-waits.js +0 -20
- package/dist/review/write-deny.js +0 -170
- package/dist/shared/conflict-ai.js +0 -24
- package/dist/sync/benchmark-rollup.js +0 -50
- package/public/assets/index-CbEfmqOD.css +0 -1
- package/public/assets/index-DBK4RWQu.js +0 -136
package/dist/db/schema.js
DELETED
|
@@ -1,321 +0,0 @@
|
|
|
1
|
-
import { sqliteTable, text, integer, real, index, uniqueIndex, } from 'drizzle-orm/sqlite-core';
|
|
2
|
-
import { sql } from 'drizzle-orm';
|
|
3
|
-
export const repos = sqliteTable('repos', {
|
|
4
|
-
id: integer('id').primaryKey({ autoIncrement: true }),
|
|
5
|
-
owner: text('owner').notNull(),
|
|
6
|
-
name: text('name').notNull(),
|
|
7
|
-
githubNodeId: text('github_node_id').notNull().unique(),
|
|
8
|
-
// The repo's default branch (GraphQL defaultBranchRef.name), captured each
|
|
9
|
-
// activity sync. Used to scope the "maintainer" inference to PRs merged into
|
|
10
|
-
// the default branch. Null until a sync populates it.
|
|
11
|
-
defaultBranch: text('default_branch'),
|
|
12
|
-
backfillUntil: integer('backfill_until', { mode: 'timestamp' }),
|
|
13
|
-
createdAt: integer('created_at', { mode: 'timestamp' })
|
|
14
|
-
.notNull()
|
|
15
|
-
.default(sql `(unixepoch())`),
|
|
16
|
-
}, (t) => ({ ownerNameUx: uniqueIndex('repos_owner_name').on(t.owner, t.name) }));
|
|
17
|
-
export const users = sqliteTable('users', {
|
|
18
|
-
id: integer('id').primaryKey({ autoIncrement: true }),
|
|
19
|
-
githubLogin: text('github_login').notNull().unique(),
|
|
20
|
-
githubNodeId: text('github_node_id').unique(),
|
|
21
|
-
displayName: text('display_name'),
|
|
22
|
-
avatarUrl: text('avatar_url'),
|
|
23
|
-
isBot: integer('is_bot', { mode: 'boolean' }).notNull().default(false),
|
|
24
|
-
// Set when a user toggles is_bot by hand; auto-detection won't override it.
|
|
25
|
-
isBotOverridden: integer('is_bot_overridden', { mode: 'boolean' })
|
|
26
|
-
.notNull()
|
|
27
|
-
.default(false),
|
|
28
|
-
});
|
|
29
|
-
export const pullRequests = sqliteTable('pull_requests', {
|
|
30
|
-
id: integer('id').primaryKey({ autoIncrement: true }),
|
|
31
|
-
githubNodeId: text('github_node_id').notNull().unique(),
|
|
32
|
-
repoId: integer('repo_id')
|
|
33
|
-
.notNull()
|
|
34
|
-
.references(() => repos.id),
|
|
35
|
-
number: integer('number').notNull(),
|
|
36
|
-
title: text('title').notNull(),
|
|
37
|
-
body: text('body'),
|
|
38
|
-
authorId: integer('author_id').references(() => users.id),
|
|
39
|
-
// Who actually merged the PR (GraphQL `mergedBy`), distinct from the author.
|
|
40
|
-
// Drives the "has merge rights / maintainer" inference. Null for non-merged
|
|
41
|
-
// PRs and until a (deep) sync backfills it on already-synced merged PRs.
|
|
42
|
-
mergedById: integer('merged_by_id').references(() => users.id),
|
|
43
|
-
// The branch this PR targets (GraphQL `baseRefName`). The maintainer
|
|
44
|
-
// inference only counts merges into the repo's default branch, so a merge
|
|
45
|
-
// into a feature/integration branch doesn't elevate the merger. Null until a
|
|
46
|
-
// (deep) sync backfills it on already-synced PRs.
|
|
47
|
-
baseRefName: text('base_ref_name'),
|
|
48
|
-
state: text('state', { enum: ['open', 'merged', 'closed'] }).notNull(),
|
|
49
|
-
isDraft: integer('is_draft', { mode: 'boolean' }).notNull().default(false),
|
|
50
|
-
openedAt: integer('opened_at', { mode: 'timestamp' }).notNull(),
|
|
51
|
-
firstReviewAt: integer('first_review_at', { mode: 'timestamp' }),
|
|
52
|
-
lastCommitAt: integer('last_commit_at', { mode: 'timestamp' }),
|
|
53
|
-
mergedAt: integer('merged_at', { mode: 'timestamp' }),
|
|
54
|
-
closedAt: integer('closed_at', { mode: 'timestamp' }),
|
|
55
|
-
updatedAt: integer('updated_at', { mode: 'timestamp' }).notNull(),
|
|
56
|
-
// ---- v1.1: CI / mergeability / labels (head-commit derived) ----
|
|
57
|
-
headSha: text('head_sha'),
|
|
58
|
-
ciStatus: text('ci_status', {
|
|
59
|
-
enum: ['success', 'failure', 'pending', 'error', 'expected', 'unknown'],
|
|
60
|
-
}),
|
|
61
|
-
mergeable: text('mergeable', {
|
|
62
|
-
enum: ['mergeable', 'conflicting', 'unknown'],
|
|
63
|
-
}),
|
|
64
|
-
mergeStateStatus: text('merge_state_status', {
|
|
65
|
-
enum: [
|
|
66
|
-
'clean',
|
|
67
|
-
'dirty',
|
|
68
|
-
'unstable',
|
|
69
|
-
'blocked',
|
|
70
|
-
'behind',
|
|
71
|
-
'has_hooks',
|
|
72
|
-
'unknown',
|
|
73
|
-
],
|
|
74
|
-
}),
|
|
75
|
-
labels: text('labels', { mode: 'json' }).$type(),
|
|
76
|
-
// Per-job CI checks on the head commit (CheckRuns + StatusContexts).
|
|
77
|
-
checkRuns: text('check_runs', { mode: 'json' }).$type(),
|
|
78
|
-
}, (t) => ({
|
|
79
|
-
repoIdx: index('pr_repo_idx').on(t.repoId),
|
|
80
|
-
openedIdx: index('pr_opened_idx').on(t.openedAt),
|
|
81
|
-
}));
|
|
82
|
-
// Outstanding review requests on a PR. GitHub removes a request once the
|
|
83
|
-
// reviewer submits, so presence here == still awaiting. Re-derived each sync
|
|
84
|
-
// (delete + reinsert per PR). `userId` null for team requests (teamName set).
|
|
85
|
-
export const reviewRequests = sqliteTable('review_requests', {
|
|
86
|
-
id: integer('id').primaryKey({ autoIncrement: true }),
|
|
87
|
-
prId: integer('pr_id')
|
|
88
|
-
.notNull()
|
|
89
|
-
.references(() => pullRequests.id),
|
|
90
|
-
userId: integer('user_id').references(() => users.id),
|
|
91
|
-
teamName: text('team_name'),
|
|
92
|
-
}, (t) => ({
|
|
93
|
-
prIdx: index('rr_pr_idx').on(t.prId),
|
|
94
|
-
userIdx: index('rr_user_idx').on(t.userId),
|
|
95
|
-
}));
|
|
96
|
-
// Per-PR "last viewed" state for incremental review. One row per PR.
|
|
97
|
-
export const prViews = sqliteTable('pr_views', {
|
|
98
|
-
prId: integer('pr_id')
|
|
99
|
-
.primaryKey()
|
|
100
|
-
.references(() => pullRequests.id),
|
|
101
|
-
lastViewedSha: text('last_viewed_sha'),
|
|
102
|
-
lastViewedAt: integer('last_viewed_at', { mode: 'timestamp' }).notNull(),
|
|
103
|
-
});
|
|
104
|
-
// Manual dismissals of "my turn" entries. `refId` is a PR id (review_request)
|
|
105
|
-
// or a review-thread id (thread). The dismissal is honoured only while no newer
|
|
106
|
-
// activity has happened — getMyTurn compares dismissedAt against the PR's
|
|
107
|
-
// updatedAt / the thread's last reply, so it auto-resurfaces.
|
|
108
|
-
export const myTurnDismissals = sqliteTable('my_turn_dismissals', {
|
|
109
|
-
id: integer('id').primaryKey({ autoIncrement: true }),
|
|
110
|
-
kind: text('kind', { enum: ['review_request', 'thread'] }).notNull(),
|
|
111
|
-
refId: integer('ref_id').notNull(),
|
|
112
|
-
dismissedAt: integer('dismissed_at', { mode: 'timestamp' }).notNull(),
|
|
113
|
-
}, (t) => ({ kindRefUx: uniqueIndex('mtd_kind_ref_ux').on(t.kind, t.refId) }));
|
|
114
|
-
// Singleton (id always 1): the locally-authenticated GitHub user, cached from
|
|
115
|
-
// `gh api user` so triage ("my turn") knows who "you" are.
|
|
116
|
-
export const localUser = sqliteTable('local_user', {
|
|
117
|
-
id: integer('id').primaryKey(),
|
|
118
|
-
githubLogin: text('github_login').notNull(),
|
|
119
|
-
githubId: text('github_id').notNull(),
|
|
120
|
-
avatarUrl: text('avatar_url'),
|
|
121
|
-
cachedAt: integer('cached_at', { mode: 'timestamp' }).notNull(),
|
|
122
|
-
});
|
|
123
|
-
export const reviewThreads = sqliteTable('review_threads', {
|
|
124
|
-
id: integer('id').primaryKey({ autoIncrement: true }),
|
|
125
|
-
githubNodeId: text('github_node_id').notNull().unique(),
|
|
126
|
-
prId: integer('pr_id')
|
|
127
|
-
.notNull()
|
|
128
|
-
.references(() => pullRequests.id),
|
|
129
|
-
path: text('path').notNull(),
|
|
130
|
-
line: integer('line'),
|
|
131
|
-
isResolved: integer('is_resolved', { mode: 'boolean' }).notNull(),
|
|
132
|
-
isOutdated: integer('is_outdated', { mode: 'boolean' })
|
|
133
|
-
.notNull()
|
|
134
|
-
.default(false),
|
|
135
|
-
derivedState: text('derived_state', {
|
|
136
|
-
enum: ['resolved', 'likely_addressed', 'replied_unresolved', 'untouched'],
|
|
137
|
-
}).notNull(),
|
|
138
|
-
originalCommenterId: integer('original_commenter_id').references(() => users.id),
|
|
139
|
-
createdAt: integer('created_at', { mode: 'timestamp' }).notNull(),
|
|
140
|
-
}, (t) => ({ prIdx: index('thread_pr_idx').on(t.prId) }));
|
|
141
|
-
export const reviewComments = sqliteTable('review_comments', {
|
|
142
|
-
id: integer('id').primaryKey({ autoIncrement: true }),
|
|
143
|
-
githubNodeId: text('github_node_id').notNull().unique(),
|
|
144
|
-
threadId: integer('thread_id')
|
|
145
|
-
.notNull()
|
|
146
|
-
.references(() => reviewThreads.id),
|
|
147
|
-
prId: integer('pr_id')
|
|
148
|
-
.notNull()
|
|
149
|
-
.references(() => pullRequests.id),
|
|
150
|
-
authorId: integer('author_id').references(() => users.id),
|
|
151
|
-
body: text('body').notNull(),
|
|
152
|
-
diffHunk: text('diff_hunk'),
|
|
153
|
-
// GitHub numeric id (fullDatabaseId) for the #discussion_r<id> deep link.
|
|
154
|
-
databaseId: text('database_id'),
|
|
155
|
-
createdAt: integer('created_at', { mode: 'timestamp' }).notNull(),
|
|
156
|
-
}, (t) => ({ threadIdx: index('rc_thread_idx').on(t.threadId) }));
|
|
157
|
-
export const prComments = sqliteTable('pr_comments', {
|
|
158
|
-
id: integer('id').primaryKey({ autoIncrement: true }),
|
|
159
|
-
githubNodeId: text('github_node_id').notNull().unique(),
|
|
160
|
-
prId: integer('pr_id')
|
|
161
|
-
.notNull()
|
|
162
|
-
.references(() => pullRequests.id),
|
|
163
|
-
authorId: integer('author_id').references(() => users.id),
|
|
164
|
-
body: text('body').notNull(),
|
|
165
|
-
// GitHub numeric id (fullDatabaseId) for the #issuecomment-<id> deep link.
|
|
166
|
-
databaseId: text('database_id'),
|
|
167
|
-
createdAt: integer('created_at', { mode: 'timestamp' }).notNull(),
|
|
168
|
-
}, (t) => ({ prIdx: index('prc_pr_idx').on(t.prId) }));
|
|
169
|
-
export const reviews = sqliteTable('reviews', {
|
|
170
|
-
id: integer('id').primaryKey({ autoIncrement: true }),
|
|
171
|
-
githubNodeId: text('github_node_id').notNull().unique(),
|
|
172
|
-
prId: integer('pr_id')
|
|
173
|
-
.notNull()
|
|
174
|
-
.references(() => pullRequests.id),
|
|
175
|
-
authorId: integer('author_id').references(() => users.id),
|
|
176
|
-
state: text('state', {
|
|
177
|
-
enum: ['approved', 'changes_requested', 'commented', 'dismissed', 'pending'],
|
|
178
|
-
}).notNull(),
|
|
179
|
-
body: text('body'),
|
|
180
|
-
// GitHub numeric id (fullDatabaseId) for the #pullrequestreview-<id> deep link.
|
|
181
|
-
databaseId: text('database_id'),
|
|
182
|
-
submittedAt: integer('submitted_at', { mode: 'timestamp' }).notNull(),
|
|
183
|
-
}, (t) => ({ prIdx: index('rv_pr_idx').on(t.prId) }));
|
|
184
|
-
export const commits = sqliteTable('commits', {
|
|
185
|
-
id: integer('id').primaryKey({ autoIncrement: true }),
|
|
186
|
-
sha: text('sha').notNull(),
|
|
187
|
-
prId: integer('pr_id')
|
|
188
|
-
.notNull()
|
|
189
|
-
.references(() => pullRequests.id),
|
|
190
|
-
authorId: integer('author_id').references(() => users.id),
|
|
191
|
-
committerId: integer('committer_id').references(() => users.id),
|
|
192
|
-
message: text('message'),
|
|
193
|
-
committedAt: integer('committed_at', { mode: 'timestamp' }).notNull(),
|
|
194
|
-
}, (t) => ({
|
|
195
|
-
prIdx: index('commit_pr_idx').on(t.prId),
|
|
196
|
-
shaPrUx: uniqueIndex('commit_sha_pr_ux').on(t.sha, t.prId),
|
|
197
|
-
}));
|
|
198
|
-
// SHA -> string[] of changed paths. Cached forever (SHAs are immutable).
|
|
199
|
-
export const commitFiles = sqliteTable('commit_files', {
|
|
200
|
-
sha: text('sha').primaryKey(),
|
|
201
|
-
paths: text('paths', { mode: 'json' }).$type().notNull(),
|
|
202
|
-
fetchedAt: integer('fetched_at', { mode: 'timestamp' })
|
|
203
|
-
.notNull()
|
|
204
|
-
.default(sql `(unixepoch())`),
|
|
205
|
-
});
|
|
206
|
-
// Unified events log -- what the timeline reads.
|
|
207
|
-
export const events = sqliteTable('events', {
|
|
208
|
-
id: integer('id').primaryKey({ autoIncrement: true }),
|
|
209
|
-
repoId: integer('repo_id')
|
|
210
|
-
.notNull()
|
|
211
|
-
.references(() => repos.id),
|
|
212
|
-
actorId: integer('actor_id').references(() => users.id),
|
|
213
|
-
prId: integer('pr_id').references(() => pullRequests.id),
|
|
214
|
-
type: text('type', {
|
|
215
|
-
enum: [
|
|
216
|
-
'pr_opened',
|
|
217
|
-
'pr_merged',
|
|
218
|
-
'pr_closed',
|
|
219
|
-
'pr_reopened',
|
|
220
|
-
'pr_ready_for_review',
|
|
221
|
-
'review_submitted',
|
|
222
|
-
'review_comment',
|
|
223
|
-
'pr_comment',
|
|
224
|
-
'commit_pushed',
|
|
225
|
-
],
|
|
226
|
-
}).notNull(),
|
|
227
|
-
occurredAt: integer('occurred_at', { mode: 'timestamp' }).notNull(),
|
|
228
|
-
refTable: text('ref_table'),
|
|
229
|
-
refId: integer('ref_id'),
|
|
230
|
-
// Stable identity for idempotent upserts: e.g. "pr_opened:<prNodeId>".
|
|
231
|
-
dedupeKey: text('dedupe_key').notNull().unique(),
|
|
232
|
-
}, (t) => ({
|
|
233
|
-
timeIdx: index('events_time_idx').on(t.occurredAt),
|
|
234
|
-
repoTimeIdx: index('events_repo_time_idx').on(t.repoId, t.occurredAt),
|
|
235
|
-
actorIdx: index('events_actor_idx').on(t.actorId),
|
|
236
|
-
}));
|
|
237
|
-
export const syncState = sqliteTable('sync_state', {
|
|
238
|
-
repoId: integer('repo_id')
|
|
239
|
-
.primaryKey()
|
|
240
|
-
.references(() => repos.id),
|
|
241
|
-
lastFullSyncAt: integer('last_full_sync_at', { mode: 'timestamp' }),
|
|
242
|
-
lastIncrementalSyncAt: integer('last_incremental_sync_at', {
|
|
243
|
-
mode: 'timestamp',
|
|
244
|
-
}),
|
|
245
|
-
lastSyncStatus: text('last_sync_status'),
|
|
246
|
-
lastSyncError: text('last_sync_error'),
|
|
247
|
-
});
|
|
248
|
-
// ---- Claude Review (agentic PR review) ----
|
|
249
|
-
// One row per review run. Re-reviewing a PR inserts a new row (history kept,
|
|
250
|
-
// keyed by head SHA via cr_pr_sha_idx). Claude's summary/verdict are read-only
|
|
251
|
-
// reference; the user authors `userBody`/`userVerdict` which is what gets posted.
|
|
252
|
-
export const claudeReviews = sqliteTable('claude_reviews', {
|
|
253
|
-
id: integer('id').primaryKey({ autoIncrement: true }),
|
|
254
|
-
prId: integer('pr_id')
|
|
255
|
-
.notNull()
|
|
256
|
-
.references(() => pullRequests.id),
|
|
257
|
-
headSha: text('head_sha').notNull(),
|
|
258
|
-
status: text('status', {
|
|
259
|
-
enum: ['queued', 'running', 'succeeded', 'failed', 'cancelled'],
|
|
260
|
-
}).notNull(),
|
|
261
|
-
model: text('model', {
|
|
262
|
-
enum: ['claude-opus-4-8', 'claude-sonnet-4-6', 'claude-haiku-4-5'],
|
|
263
|
-
}).notNull(),
|
|
264
|
-
// Null until the agent decides whether it explored the worktree.
|
|
265
|
-
scope: text('scope', { enum: ['diff_only', 'worktree'] }),
|
|
266
|
-
// Claude's output (read-only; never edited in place).
|
|
267
|
-
summary: text('summary'),
|
|
268
|
-
verdict: text('verdict', {
|
|
269
|
-
enum: ['COMMENT', 'REQUEST_CHANGES', 'APPROVE'],
|
|
270
|
-
}),
|
|
271
|
-
// The user-authored review body + verdict that actually get posted.
|
|
272
|
-
userBody: text('user_body'),
|
|
273
|
-
userVerdict: text('user_verdict', {
|
|
274
|
-
enum: ['COMMENT', 'REQUEST_CHANGES', 'APPROVE'],
|
|
275
|
-
}),
|
|
276
|
-
costUsd: real('cost_usd'),
|
|
277
|
-
inputTokens: integer('input_tokens'),
|
|
278
|
-
outputTokens: integer('output_tokens'),
|
|
279
|
-
numTurns: integer('num_turns'),
|
|
280
|
-
error: text('error'),
|
|
281
|
-
// Noise files (lockfiles/generated) stripped from the diff before review.
|
|
282
|
-
excludedFiles: text('excluded_files', { mode: 'json' }).$type(),
|
|
283
|
-
// GitHub review id + when it was posted (null until posted).
|
|
284
|
-
postedReviewId: text('posted_review_id'),
|
|
285
|
-
postedAt: integer('posted_at', { mode: 'timestamp' }),
|
|
286
|
-
createdAt: integer('created_at', { mode: 'timestamp' })
|
|
287
|
-
.notNull()
|
|
288
|
-
.default(sql `(unixepoch())`),
|
|
289
|
-
finishedAt: integer('finished_at', { mode: 'timestamp' }),
|
|
290
|
-
}, (t) => ({
|
|
291
|
-
prIdx: index('cr_pr_idx').on(t.prId),
|
|
292
|
-
prShaIdx: index('cr_pr_sha_idx').on(t.prId, t.headSha),
|
|
293
|
-
}));
|
|
294
|
-
// One row per line-level finding. Claude's wording is read-only; only `included`
|
|
295
|
-
// (the user's tick) mutates. `anchored` false ⇒ couldn't map onto an addable diff
|
|
296
|
-
// line, so it can't post as an inline comment.
|
|
297
|
-
export const claudeReviewFindings = sqliteTable('claude_review_findings', {
|
|
298
|
-
id: integer('id').primaryKey({ autoIncrement: true }),
|
|
299
|
-
reviewId: integer('review_id')
|
|
300
|
-
.notNull()
|
|
301
|
-
.references(() => claudeReviews.id),
|
|
302
|
-
path: text('path').notNull(),
|
|
303
|
-
line: integer('line'),
|
|
304
|
-
side: text('side', { enum: ['LEFT', 'RIGHT'] })
|
|
305
|
-
.notNull()
|
|
306
|
-
.default('RIGHT'),
|
|
307
|
-
severity: text('severity', {
|
|
308
|
-
enum: ['blocker', 'warning', 'nit', 'question', 'praise'],
|
|
309
|
-
}).notNull(),
|
|
310
|
-
title: text('title').notNull(),
|
|
311
|
-
body: text('body').notNull(),
|
|
312
|
-
suggestion: text('suggestion'),
|
|
313
|
-
anchored: integer('anchored', { mode: 'boolean' }).notNull().default(true),
|
|
314
|
-
included: integer('included', { mode: 'boolean' }).notNull().default(false),
|
|
315
|
-
postedAt: integer('posted_at', { mode: 'timestamp' }),
|
|
316
|
-
githubCommentId: text('github_comment_id'),
|
|
317
|
-
createdAt: integer('created_at', { mode: 'timestamp' })
|
|
318
|
-
.notNull()
|
|
319
|
-
.default(sql `(unixepoch())`),
|
|
320
|
-
}, (t) => ({ reviewIdx: index('crf_review_idx').on(t.reviewId) }));
|
|
321
|
-
//# sourceMappingURL=schema.js.map
|