@cat-factory/node-server 0.117.1 → 0.119.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.
Files changed (37) hide show
  1. package/dist/container-core-deps.js +1 -0
  2. package/dist/container-core-deps.js.map +1 -1
  3. package/dist/container-github-deps.d.ts.map +1 -1
  4. package/dist/container-github-deps.js +13 -3
  5. package/dist/container-github-deps.js.map +1 -1
  6. package/dist/db/schema/tracker.d.ts +651 -0
  7. package/dist/db/schema/tracker.d.ts.map +1 -0
  8. package/dist/db/schema/tracker.js +83 -0
  9. package/dist/db/schema/tracker.js.map +1 -0
  10. package/dist/db/schema.d.ts +943 -2450
  11. package/dist/db/schema.d.ts.map +1 -1
  12. package/dist/db/schema.js +54 -206
  13. package/dist/db/schema.js.map +1 -1
  14. package/dist/db/tables/vcs.d.ts +1339 -0
  15. package/dist/db/tables/vcs.d.ts.map +1 -0
  16. package/dist/db/tables/vcs.js +170 -0
  17. package/dist/db/tables/vcs.js.map +1 -0
  18. package/dist/repositories/drizzle/initiatives.d.ts.map +1 -1
  19. package/dist/repositories/drizzle/initiatives.js +5 -0
  20. package/dist/repositories/drizzle/initiatives.js.map +1 -1
  21. package/dist/repositories/drizzle/mergeTrackRecord.d.ts +24 -0
  22. package/dist/repositories/drizzle/mergeTrackRecord.d.ts.map +1 -0
  23. package/dist/repositories/drizzle/mergeTrackRecord.js +162 -0
  24. package/dist/repositories/drizzle/mergeTrackRecord.js.map +1 -0
  25. package/dist/repositories/drizzle/settings.d.ts +24 -1
  26. package/dist/repositories/drizzle/settings.d.ts.map +1 -1
  27. package/dist/repositories/drizzle/settings.js +83 -2
  28. package/dist/repositories/drizzle/settings.js.map +1 -1
  29. package/dist/repositories/drizzle.d.ts +2 -1
  30. package/dist/repositories/drizzle.d.ts.map +1 -1
  31. package/dist/repositories/drizzle.js +2 -0
  32. package/dist/repositories/drizzle.js.map +1 -1
  33. package/drizzle/20260726225401_merge_track_records/migration.sql +29 -0
  34. package/drizzle/20260726225401_merge_track_records/snapshot.json +16963 -0
  35. package/drizzle/20260727041825_medical_black_widow/migration.sql +14 -0
  36. package/drizzle/20260727041825_medical_black_widow/snapshot.json +16900 -0
  37. package/package.json +20 -20
@@ -0,0 +1,83 @@
1
+ import { bigint, index, integer, pgTable, primaryKey, text } from 'drizzle-orm/pg-core';
2
+ // The ISSUE-TRACKER surface's Drizzle tables, split out of `db/schema.ts` along the boundary the
3
+ // architecture already draws: the tracker integration is one opt-in concern (a workspace's tracker
4
+ // selection + writeback toggles, its per-source connections and the local projection of the issues
5
+ // it imported, and the writeback's own bookkeeping), wired as a unit by `container-github-deps.ts`
6
+ // and served by `@cat-factory/integrations`' tracker/writeback modules. Keeping those tables in a
7
+ // sibling module — re-exported from `db/schema.ts`, so every importer and drizzle-kit see exactly
8
+ // the same surface — makes that grouping visible in the file layout and keeps the core schema
9
+ // module under its size budget. Same pattern as `./sandbox.js`.
10
+ // A workspace's issue-tracker selection (mirror of D1 migration 0029).
11
+ export const trackerSettings = pgTable('tracker_settings', {
12
+ workspace_id: text('workspace_id').primaryKey(),
13
+ tracker: text('tracker'),
14
+ jira_project_key: text('jira_project_key'),
15
+ linear_team_id: text('linear_team_id'),
16
+ // Issue-tracker writeback toggles (0/1): comment on a task's linked issue when its
17
+ // PR opens, and comment + close as resolved when it merges. Per-task overridable.
18
+ writeback_comment_on_pr_open: integer('writeback_comment_on_pr_open').notNull().default(0),
19
+ writeback_resolve_on_merge: integer('writeback_resolve_on_merge').notNull().default(0),
20
+ // Headless clarification loop (mirror of D1 migration 0062): echo a PARKED public-API run's
21
+ // open requirements findings onto the task's linked tracker issue(s). Per-task overridable.
22
+ writeback_questions_on_park: integer('writeback_questions_on_park').notNull().default(0),
23
+ updated_at: bigint('updated_at', { mode: 'number' }).notNull(),
24
+ });
25
+ // Idempotency markers for the question writeback above (mirror of D1 migration 0062): one row
26
+ // per (workspace, review, iteration, linked issue). The post runs in the DURABLE driver, whose
27
+ // steps replay, so the row is CLAIMED before the comment is attempted — otherwise every replay
28
+ // of a parked gate step would re-post the same findings. A `failed` row is re-claimable (retry
29
+ // a tracker outage); `posted` is terminal for that iteration.
30
+ export const reviewQuestionPosts = pgTable('review_question_posts', {
31
+ workspace_id: text('workspace_id').notNull(),
32
+ review_id: text('review_id').notNull(),
33
+ iteration: integer('iteration').notNull(),
34
+ issue_ref: text('issue_ref').notNull(),
35
+ status: text('status').notNull(),
36
+ attempts: integer('attempts').notNull().default(0),
37
+ error: text('error'),
38
+ updated_at: bigint('updated_at', { mode: 'number' }).notNull(),
39
+ }, (t) => [primaryKey({ columns: [t.workspace_id, t.review_id, t.iteration, t.issue_ref] })]);
40
+ // Task-source integration (mirror of D1 migration 0014): a workspace's connections
41
+ // to external issue trackers (Jira) and local projections of the issues it imported.
42
+ // `credentials` is an encrypted JSON bag (AES-256-GCM envelope), never sent on the
43
+ // wire. At most one live connection per (workspace, source); a `deleted_at` tombstone
44
+ // lets a workspace disconnect/reconnect.
45
+ export const taskConnections = pgTable('task_connections', {
46
+ workspace_id: text('workspace_id').notNull(),
47
+ source: text('source').notNull(),
48
+ credentials: text('credentials').notNull(),
49
+ label: text('label').notNull().default(''),
50
+ created_at: bigint('created_at', { mode: 'number' }).notNull(),
51
+ deleted_at: bigint('deleted_at', { mode: 'number' }),
52
+ }, (t) => [primaryKey({ columns: [t.workspace_id, t.source] })]);
53
+ // Per-workspace task-source toggle (mirrors D1 migration 0008). No row ⇒ the
54
+ // default (enabled), so a source is offered as soon as it's available; an
55
+ // `enabled: false` row is an explicit opt-out. Replaces the TASK_SOURCES env gate.
56
+ export const taskSourceSettings = pgTable('task_source_settings', {
57
+ workspace_id: text('workspace_id').notNull(),
58
+ source: text('source').notNull(),
59
+ // Integer 0/1 to match the D1 (SQLite) store, per this file's boolean convention.
60
+ enabled: integer('enabled').notNull().default(1),
61
+ }, (t) => [primaryKey({ columns: [t.workspace_id, t.source] })]);
62
+ export const tasks = pgTable('tasks', {
63
+ workspace_id: text('workspace_id').notNull(),
64
+ source: text('source').notNull(),
65
+ external_id: text('external_id').notNull(),
66
+ title: text('title').notNull(),
67
+ url: text('url').notNull(),
68
+ status: text('status').notNull().default(''),
69
+ type: text('type').notNull().default(''),
70
+ assignee: text('assignee'),
71
+ priority: text('priority'),
72
+ labels: text('labels').notNull().default('[]'),
73
+ description: text('description').notNull().default(''),
74
+ comments: text('comments').notNull().default('[]'),
75
+ excerpt: text('excerpt').notNull().default(''),
76
+ linked_block_id: text('linked_block_id'),
77
+ synced_at: bigint('synced_at', { mode: 'number' }).notNull(),
78
+ deleted_at: bigint('deleted_at', { mode: 'number' }),
79
+ }, (t) => [
80
+ primaryKey({ columns: [t.workspace_id, t.source, t.external_id] }),
81
+ index('idx_tasks_block').on(t.workspace_id, t.linked_block_id),
82
+ ]);
83
+ //# sourceMappingURL=tracker.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tracker.js","sourceRoot":"","sources":["../../../src/db/schema/tracker.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAA;AAEvF,iGAAiG;AACjG,mGAAmG;AACnG,mGAAmG;AACnG,mGAAmG;AACnG,kGAAkG;AAClG,kGAAkG;AAClG,8FAA8F;AAC9F,gEAAgE;AAEhE,uEAAuE;AACvE,MAAM,CAAC,MAAM,eAAe,GAAG,OAAO,CAAC,kBAAkB,EAAE;IACzD,YAAY,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC,UAAU,EAAE;IAC/C,OAAO,EAAE,IAAI,CAAC,SAAS,CAAC;IACxB,gBAAgB,EAAE,IAAI,CAAC,kBAAkB,CAAC;IAC1C,cAAc,EAAE,IAAI,CAAC,gBAAgB,CAAC;IACtC,mFAAmF;IACnF,kFAAkF;IAClF,4BAA4B,EAAE,OAAO,CAAC,8BAA8B,CAAC,CAAC,OAAO,EAAE,CAAC,OAAO,C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