pierre-review 0.1.39 → 0.1.40

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,45 @@
1
+ import { getActivity, getConsolidatedFeed, listClaudeReviewsByRepo } from '../../db/queries.js';
2
+ import { accountIdOf } from '../plugins/auth.js';
3
+ function parseIntList(raw) {
4
+ if (!raw)
5
+ return null;
6
+ const ids = raw
7
+ .split(',')
8
+ .map((s) => Number.parseInt(s.trim(), 10))
9
+ .filter((n) => Number.isFinite(n));
10
+ return ids.length > 0 ? ids : null;
11
+ }
12
+ export async function activityRoutes(app) {
13
+ // The Activity aggregate: per repo, current-state stats + thread totals +
14
+ // attention/unread flags + open PRs. Scoped to the account; `repoIds` + `userIds`
15
+ // narrow to the active FilterBar repo + member selection (across ALL the account's
16
+ // repos — watched-only was dropped). Pure DB read — no GitHub sync, no AI.
17
+ app.get('/api/activity', async (req) => {
18
+ const q = req.query;
19
+ return getActivity(accountIdOf(req), parseIntList(q.repoIds), parseIntList(q.userIds));
20
+ });
21
+ // The consolidated Feed (the Activity "Feed" entry): one flat, chronological stream
22
+ // merging My Turn actionables + the activity feed, deduped. Scoped by the FilterBar
23
+ // repo + member selection across ALL the account's repos (watched-only dropped).
24
+ // Pure DB read — no GitHub sync, no AI.
25
+ app.get('/api/activity/feed', async (req) => {
26
+ const q = req.query;
27
+ const limit = q.limit != null ? Number(q.limit) : null;
28
+ const offset = q.offset != null ? Number(q.offset) : 0;
29
+ return getConsolidatedFeed(accountIdOf(req), {
30
+ repoIds: parseIntList(q.repoIds),
31
+ userIds: parseIntList(q.userIds),
32
+ limit: Number.isFinite(limit) && limit != null && limit > 0 ? limit : null,
33
+ offset: Number.isFinite(offset) && offset > 0 ? offset : 0,
34
+ excludeBots: q.excludeBots === 'true',
35
+ });
36
+ });
37
+ // Repo-scoped Claude-review history for the Activity single-repo console. Ownership +
38
+ // feature-gating are handled inside the query (an unowned repo / disabled feature
39
+ // both return an empty list), so the caller never leaks another account's data.
40
+ app.get('/api/repos/:id/claude-reviews', async (req) => {
41
+ const { id } = req.params;
42
+ return listClaudeReviewsByRepo(Number.parseInt(id, 10), accountIdOf(req));
43
+ });
44
+ }
45
+ //# sourceMappingURL=activity.js.map
@@ -4,6 +4,8 @@ import { accountIdOf } from '../plugins/auth.js';
4
4
  // has Watched, newest first, commit pushes excluded. The frontend mirrors these into an
5
5
  // append-only IndexedDB store (see lib/feedStore.ts). Account-scoped.
6
6
  export async function feedRoutes(app) {
7
- app.get('/api/feed', async (req) => getFeed(accountIdOf(req), 14));
7
+ // getFeed's default is now all-repos; preserve this legacy mirror's watched-repo-only
8
+ // semantics explicitly (the consolidated Activity Feed supersedes this endpoint).
9
+ app.get('/api/feed', async (req) => getFeed(accountIdOf(req), { daysBefore: 14, watchedOnly: true }));
8
10
  }
9
11
  //# sourceMappingURL=feed.js.map
@@ -230,7 +230,7 @@ export async function repoRoutes(app) {
230
230
  reply.status(201);
231
231
  return getRepo(repoId, accountId);
232
232
  });
233
- // Toggle "Watch for inbox" on a repo. Inbox-only: it does not affect timeline
233
+ // Toggle "Watch for inbox" on a repo. Activity-only: it does not affect timeline
234
234
  // visibility or syncing. Ownership-scoped → 404 for a repo this account doesn't own.
235
235
  app.patch('/api/repos/:id', { schema: watchSchema }, async (req, reply) => {
236
236
  const { id } = req.params;
package/dist/app.js CHANGED
@@ -18,7 +18,7 @@ import { openPrsRoutes } from './api/routes/open-prs.js';
18
18
  import { feedRoutes } from './api/routes/feed.js';
19
19
  import { mergersRoutes } from './api/routes/mergers.js';
20
20
  import { insightsRoutes } from './api/routes/insights.js';
21
- import { inboxRoutes } from './api/routes/inbox.js';
21
+ import { activityRoutes } from './api/routes/activity.js';
22
22
  import { claudeReviewRoutes } from './api/routes/claude-review.js';
23
23
  export async function buildApp() {
24
24
  const app = Fastify({
@@ -131,7 +131,7 @@ export async function buildApp() {
131
131
  await app.register(feedRoutes);
132
132
  await app.register(mergersRoutes);
133
133
  await app.register(insightsRoutes);
134
- await app.register(inboxRoutes);
134
+ await app.register(activityRoutes);
135
135
  // Claude Review is local-only + opt-in. Only register its routes when enabled,
136
136
  // so the clone-manager / gh-CLI dependency is unreachable in cloud mode.
137
137
  if (config.claudeReviewEnabled)