pierre-review 0.1.51 → 0.1.53

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.
@@ -0,0 +1,21 @@
1
+ -- CI status transition history (additive). Append-only log of a PR head's CI-state
2
+ -- transitions, recorded during sync when the CI rollup / failing-check set / head SHA
3
+ -- changes. Powers real CI failure-resolution time + failure-reason-by-stage metrics
4
+ -- (the current pull_requests.ci_status is only a snapshot; check_runs is lean-gated).
5
+ -- The Postgres baseline is regenerated separately via `pnpm db:generate:pg`.
6
+ CREATE TABLE `ci_status_events` (
7
+ `id` integer PRIMARY KEY AUTOINCREMENT NOT NULL,
8
+ `account_id` integer NOT NULL,
9
+ `repo_id` integer NOT NULL,
10
+ `pr_id` integer NOT NULL,
11
+ `head_sha` text NOT NULL,
12
+ `status` text NOT NULL,
13
+ `failing_checks` text,
14
+ `observed_at` integer NOT NULL,
15
+ FOREIGN KEY (`account_id`) REFERENCES `accounts`(`id`) ON UPDATE no action ON DELETE no action,
16
+ FOREIGN KEY (`repo_id`) REFERENCES `repos`(`id`) ON UPDATE no action ON DELETE no action,
17
+ FOREIGN KEY (`pr_id`) REFERENCES `pull_requests`(`id`) ON UPDATE no action ON DELETE no action
18
+ );
19
+ --> statement-breakpoint
20
+ CREATE INDEX `cse_account_pr_observed` ON `ci_status_events` (`account_id`,`pr_id`,`observed_at`);--> statement-breakpoint
21
+ CREATE INDEX `cse_account_repo_observed` ON `ci_status_events` (`account_id`,`repo_id`,`observed_at`);
@@ -0,0 +1,21 @@
1
+ -- AI-spend ledger (additive). Append-only: one row per billable AI operation (LLM
2
+ -- completion or Agent-SDK run) so month-to-date usage is summable across features (the
3
+ -- per-feature cost columns upsert-overwrite). Surfaced only as credits, never dollars.
4
+ -- `seam` = summary (cheap completions) | agent (Agent-SDK runs). No FK on pr_id/repo_id
5
+ -- so the ledger survives PR/repo pruning. Postgres baseline regenerated via `db:generate:pg`.
6
+ CREATE TABLE `ai_usage` (
7
+ `id` integer PRIMARY KEY AUTOINCREMENT NOT NULL,
8
+ `account_id` integer NOT NULL,
9
+ `seam` text NOT NULL,
10
+ `feature` text NOT NULL,
11
+ `model` text NOT NULL,
12
+ `cost_usd` real NOT NULL,
13
+ `input_tokens` integer,
14
+ `output_tokens` integer,
15
+ `pr_id` integer,
16
+ `repo_id` integer,
17
+ `occurred_at` integer NOT NULL DEFAULT (unixepoch()),
18
+ FOREIGN KEY (`account_id`) REFERENCES `accounts`(`id`) ON UPDATE no action ON DELETE no action
19
+ );
20
+ --> statement-breakpoint
21
+ CREATE INDEX `au_account_occurred` ON `ai_usage` (`account_id`,`occurred_at`);
@@ -155,6 +155,20 @@
155
155
  "when": 1780800000012,
156
156
  "tag": "0021_account_feed_last_seen",
157
157
  "breakpoints": true
158
+ },
159
+ {
160
+ "idx": 22,
161
+ "version": "6",
162
+ "when": 1780800000013,
163
+ "tag": "0022_ci_status_events",
164
+ "breakpoints": true
165
+ },
166
+ {
167
+ "idx": 23,
168
+ "version": "6",
169
+ "when": 1780800000014,
170
+ "tag": "0023_ai_usage",
171
+ "breakpoints": true
158
172
  }
159
173
  ]
160
- }
174
+ }
@@ -0,0 +1,16 @@
1
+ CREATE TABLE "ci_status_events" (
2
+ "id" serial PRIMARY KEY NOT NULL,
3
+ "account_id" integer NOT NULL,
4
+ "repo_id" integer NOT NULL,
5
+ "pr_id" integer NOT NULL,
6
+ "head_sha" text NOT NULL,
7
+ "status" text NOT NULL,
8
+ "failing_checks" jsonb,
9
+ "observed_at" timestamp with time zone NOT NULL
10
+ );
11
+ --> statement-breakpoint
12
+ ALTER TABLE "ci_status_events" ADD CONSTRAINT "ci_status_events_account_id_accounts_id_fk" FOREIGN KEY ("account_id") REFERENCES "public"."accounts"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
13
+ ALTER TABLE "ci_status_events" ADD CONSTRAINT "ci_status_events_repo_id_repos_id_fk" FOREIGN KEY ("repo_id") REFERENCES "public"."repos"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
14
+ ALTER TABLE "ci_status_events" ADD CONSTRAINT "ci_status_events_pr_id_pull_requests_id_fk" FOREIGN KEY ("pr_id") REFERENCES "public"."pull_requests"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
15
+ CREATE INDEX "cse_account_pr_observed" ON "ci_status_events" USING btree ("account_id","pr_id","observed_at");--> statement-breakpoint
16
+ CREATE INDEX "cse_account_repo_observed" ON "ci_status_events" USING btree ("account_id","repo_id","observed_at");
@@ -0,0 +1,16 @@
1
+ CREATE TABLE "ai_usage" (
2
+ "id" serial PRIMARY KEY NOT NULL,
3
+ "account_id" integer NOT NULL,
4
+ "seam" text NOT NULL,
5
+ "feature" text NOT NULL,
6
+ "model" text NOT NULL,
7
+ "cost_usd" double precision NOT NULL,
8
+ "input_tokens" integer,
9
+ "output_tokens" integer,
10
+ "pr_id" integer,
11
+ "repo_id" integer,
12
+ "occurred_at" timestamp with time zone DEFAULT now() NOT NULL
13
+ );
14
+ --> statement-breakpoint
15
+ ALTER TABLE "ai_usage" ADD CONSTRAINT "ai_usage_account_id_accounts_id_fk" FOREIGN KEY ("account_id") REFERENCES "public"."accounts"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
16
+ CREATE INDEX "au_account_occurred" ON "ai_usage" USING btree ("account_id","occurred_at");