@opensip-cli/datastore 0.1.0 → 0.1.2

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 (32) hide show
  1. package/README.md +3 -3
  2. package/migrations/0000_tense_karma.sql +73 -0
  3. package/migrations/meta/0000_snapshot.json +289 -100
  4. package/migrations/meta/_journal.json +2 -93
  5. package/package.json +2 -2
  6. package/migrations/0000_sticky_white_tiger.sql +0 -39
  7. package/migrations/0001_easy_harry_osborn.sql +0 -18
  8. package/migrations/0002_plain_amazoness.sql +0 -5
  9. package/migrations/0003_mysterious_khan.sql +0 -6
  10. package/migrations/0004_narrow_bloodscream.sql +0 -3
  11. package/migrations/0005_lying_luke_cage.sql +0 -7
  12. package/migrations/0006_mean_photon.sql +0 -12
  13. package/migrations/0007_parallel_chamber.sql +0 -3
  14. package/migrations/0008_flaky_victor_mancha.sql +0 -7
  15. package/migrations/0009_stable_tool_identity.sql +0 -9
  16. package/migrations/0010_add_timestamp_iso_and_payload_version.sql +0 -11
  17. package/migrations/0011_payload_version_safety_and_notes.sql +0 -21
  18. package/migrations/0012_overrated_talon.sql +0 -21
  19. package/migrations/0013_lovely_zarda.sql +0 -1
  20. package/migrations/meta/0001_snapshot.json +0 -369
  21. package/migrations/meta/0002_snapshot.json +0 -400
  22. package/migrations/meta/0003_snapshot.json +0 -441
  23. package/migrations/meta/0004_snapshot.json +0 -270
  24. package/migrations/meta/0005_snapshot.json +0 -315
  25. package/migrations/meta/0006_snapshot.json +0 -382
  26. package/migrations/meta/0007_snapshot.json +0 -303
  27. package/migrations/meta/0008_snapshot.json +0 -346
  28. package/migrations/meta/0009_snapshot.json +0 -367
  29. package/migrations/meta/0010_snapshot.json +0 -382
  30. package/migrations/meta/0011_snapshot.json +0 -382
  31. package/migrations/meta/0012_snapshot.json +0 -512
  32. package/migrations/meta/0013_snapshot.json +0 -458
package/README.md CHANGED
@@ -8,7 +8,7 @@
8
8
 
9
9
  This is an **internal library** of the opensip-cli toolkit. It is published so the CLI and tools can depend on it; most users will not install it directly.
10
10
 
11
- Part of [**opensip-cli**](https://github.com/opensip-ai/opensip-cli) — an open-source codebase-analysis toolkit: fitness checks (`fit`), static call-graph analysis (`graph`), and simulation (`sim`).
11
+ Part of [**opensip-cli**](https://github.com/opensip-ai/opensip-cli) — an open-source codebase intelligence CLI: fitness checks (`fit`), static call-graph analysis (`graph`), and simulation (`sim`).
12
12
 
13
13
  ## Install
14
14
 
@@ -23,8 +23,8 @@ This package is published for the CLI and advanced plugin authors; most users sh
23
23
  ## Documentation
24
24
 
25
25
  - 📚 Project docs: https://opensip.ai/docs/opensip-cli/
26
- - 🧭 Package catalog (what every package does): https://github.com/opensip-ai/opensip-cli/blob/v0.1.0/docs/public/70-reference/02-package-catalog.md
27
- - 📦 Source: https://github.com/opensip-ai/opensip-cli/tree/v0.1.0/packages/datastore
26
+ - 🧭 Package catalog (what every package does): https://github.com/opensip-ai/opensip-cli/blob/v0.1.2/docs/public/70-reference/02-package-catalog.md
27
+ - 📦 Source: https://github.com/opensip-ai/opensip-cli/tree/v0.1.2/packages/datastore
28
28
 
29
29
  ## License
30
30
 
@@ -0,0 +1,73 @@
1
+ CREATE TABLE `session_host_metrics` (
2
+ `session_id` text PRIMARY KEY NOT NULL,
3
+ `tty_busy_ms` integer,
4
+ `render_ms` integer,
5
+ `persist_ms` integer,
6
+ `egress_ms` integer,
7
+ `total_command_ms` integer,
8
+ FOREIGN KEY (`session_id`) REFERENCES `sessions`(`id`) ON UPDATE no action ON DELETE cascade
9
+ );
10
+ --> statement-breakpoint
11
+ CREATE TABLE `session_tool_payload` (
12
+ `session_id` text PRIMARY KEY NOT NULL,
13
+ `tool` text NOT NULL,
14
+ `payload` text NOT NULL,
15
+ `payload_version` integer DEFAULT 1 NOT NULL,
16
+ FOREIGN KEY (`session_id`) REFERENCES `sessions`(`id`) ON UPDATE no action ON DELETE cascade
17
+ );
18
+ --> statement-breakpoint
19
+ CREATE TABLE `sessions` (
20
+ `id` text PRIMARY KEY NOT NULL,
21
+ `tool` text NOT NULL,
22
+ `timestamp` integer NOT NULL,
23
+ `timestamp_iso` text,
24
+ `completed_at` integer,
25
+ `completed_at_iso` text,
26
+ `cwd` text NOT NULL,
27
+ `recipe` text,
28
+ `score` integer NOT NULL,
29
+ `passed` integer NOT NULL,
30
+ `duration_ms` integer NOT NULL
31
+ );
32
+ --> statement-breakpoint
33
+ CREATE INDEX `sessions_tool_timestamp_idx` ON `sessions` (`tool`,"timestamp" DESC);--> statement-breakpoint
34
+ CREATE TABLE `graph_catalog` (
35
+ `id` integer PRIMARY KEY NOT NULL,
36
+ `language` text NOT NULL,
37
+ `cache_key` text NOT NULL,
38
+ `files_fingerprint` text NOT NULL,
39
+ `built_at` text NOT NULL,
40
+ `payload` text NOT NULL
41
+ );
42
+ --> statement-breakpoint
43
+ CREATE TABLE `graph_shard_fragment` (
44
+ `shard_id` text PRIMARY KEY NOT NULL,
45
+ `language` text NOT NULL,
46
+ `cache_key` text NOT NULL,
47
+ `shard_fingerprint` text NOT NULL,
48
+ `payload` text NOT NULL
49
+ );
50
+ --> statement-breakpoint
51
+ CREATE TABLE `tool_baseline_entries` (
52
+ `tool` text NOT NULL,
53
+ `stable_id` text,
54
+ `fingerprint` text NOT NULL,
55
+ `payload` text,
56
+ `captured_at` integer NOT NULL,
57
+ PRIMARY KEY(`tool`, `fingerprint`)
58
+ );
59
+ --> statement-breakpoint
60
+ CREATE TABLE `tool_baseline_meta` (
61
+ `tool` text PRIMARY KEY NOT NULL,
62
+ `stable_id` text,
63
+ `captured_at` integer NOT NULL
64
+ );
65
+ --> statement-breakpoint
66
+ CREATE TABLE `tool_state` (
67
+ `tool` text NOT NULL,
68
+ `stable_id` text,
69
+ `key` text NOT NULL,
70
+ `payload` text,
71
+ `updated_at` integer NOT NULL,
72
+ PRIMARY KEY(`tool`, `key`)
73
+ );
@@ -1,66 +1,60 @@
1
1
  {
2
2
  "version": "6",
3
3
  "dialect": "sqlite",
4
- "id": "79fc9add-aa32-40ce-b157-72b5df13fa7e",
4
+ "id": "538ab137-ca21-4827-a58f-941c6a3d1025",
5
5
  "prevId": "00000000-0000-0000-0000-000000000000",
6
6
  "tables": {
7
- "session_checks": {
8
- "name": "session_checks",
7
+ "session_host_metrics": {
8
+ "name": "session_host_metrics",
9
9
  "columns": {
10
- "id": {
11
- "name": "id",
12
- "type": "integer",
13
- "primaryKey": true,
14
- "notNull": true,
15
- "autoincrement": true
16
- },
17
10
  "session_id": {
18
11
  "name": "session_id",
19
12
  "type": "text",
20
- "primaryKey": false,
13
+ "primaryKey": true,
21
14
  "notNull": true,
22
15
  "autoincrement": false
23
16
  },
24
- "check_slug": {
25
- "name": "check_slug",
26
- "type": "text",
17
+ "tty_busy_ms": {
18
+ "name": "tty_busy_ms",
19
+ "type": "integer",
27
20
  "primaryKey": false,
28
- "notNull": true,
21
+ "notNull": false,
29
22
  "autoincrement": false
30
23
  },
31
- "passed": {
32
- "name": "passed",
24
+ "render_ms": {
25
+ "name": "render_ms",
33
26
  "type": "integer",
34
27
  "primaryKey": false,
35
- "notNull": true,
28
+ "notNull": false,
36
29
  "autoincrement": false
37
30
  },
38
- "violation_count": {
39
- "name": "violation_count",
31
+ "persist_ms": {
32
+ "name": "persist_ms",
40
33
  "type": "integer",
41
34
  "primaryKey": false,
42
35
  "notNull": false,
43
36
  "autoincrement": false
44
37
  },
45
- "duration_ms": {
46
- "name": "duration_ms",
38
+ "egress_ms": {
39
+ "name": "egress_ms",
47
40
  "type": "integer",
48
41
  "primaryKey": false,
49
- "notNull": true,
42
+ "notNull": false,
43
+ "autoincrement": false
44
+ },
45
+ "total_command_ms": {
46
+ "name": "total_command_ms",
47
+ "type": "integer",
48
+ "primaryKey": false,
49
+ "notNull": false,
50
50
  "autoincrement": false
51
51
  }
52
52
  },
53
- "indexes": {
54
- "session_checks_session_idx": {
55
- "name": "session_checks_session_idx",
56
- "columns": ["session_id"],
57
- "isUnique": false
58
- }
59
- },
53
+ "indexes": {},
60
54
  "foreignKeys": {
61
- "session_checks_session_id_sessions_id_fk": {
62
- "name": "session_checks_session_id_sessions_id_fk",
63
- "tableFrom": "session_checks",
55
+ "session_host_metrics_session_id_sessions_id_fk": {
56
+ "name": "session_host_metrics_session_id_sessions_id_fk",
57
+ "tableFrom": "session_host_metrics",
64
58
  "tableTo": "sessions",
65
59
  "columnsFrom": ["session_id"],
66
60
  "columnsTo": ["id"],
@@ -72,112 +66,248 @@
72
66
  "uniqueConstraints": {},
73
67
  "checkConstraints": {}
74
68
  },
75
- "session_findings": {
76
- "name": "session_findings",
69
+ "session_tool_payload": {
70
+ "name": "session_tool_payload",
77
71
  "columns": {
78
- "id": {
79
- "name": "id",
80
- "type": "integer",
72
+ "session_id": {
73
+ "name": "session_id",
74
+ "type": "text",
81
75
  "primaryKey": true,
82
76
  "notNull": true,
83
- "autoincrement": true
77
+ "autoincrement": false
84
78
  },
85
- "session_check_id": {
86
- "name": "session_check_id",
87
- "type": "integer",
79
+ "tool": {
80
+ "name": "tool",
81
+ "type": "text",
88
82
  "primaryKey": false,
89
83
  "notNull": true,
90
84
  "autoincrement": false
91
85
  },
92
- "rule_id": {
93
- "name": "rule_id",
86
+ "payload": {
87
+ "name": "payload",
94
88
  "type": "text",
95
89
  "primaryKey": false,
96
90
  "notNull": true,
97
91
  "autoincrement": false
98
92
  },
99
- "severity": {
100
- "name": "severity",
101
- "type": "text",
93
+ "payload_version": {
94
+ "name": "payload_version",
95
+ "type": "integer",
102
96
  "primaryKey": false,
103
97
  "notNull": true,
98
+ "autoincrement": false,
99
+ "default": 1
100
+ }
101
+ },
102
+ "indexes": {},
103
+ "foreignKeys": {
104
+ "session_tool_payload_session_id_sessions_id_fk": {
105
+ "name": "session_tool_payload_session_id_sessions_id_fk",
106
+ "tableFrom": "session_tool_payload",
107
+ "tableTo": "sessions",
108
+ "columnsFrom": ["session_id"],
109
+ "columnsTo": ["id"],
110
+ "onDelete": "cascade",
111
+ "onUpdate": "no action"
112
+ }
113
+ },
114
+ "compositePrimaryKeys": {},
115
+ "uniqueConstraints": {},
116
+ "checkConstraints": {}
117
+ },
118
+ "sessions": {
119
+ "name": "sessions",
120
+ "columns": {
121
+ "id": {
122
+ "name": "id",
123
+ "type": "text",
124
+ "primaryKey": true,
125
+ "notNull": true,
104
126
  "autoincrement": false
105
127
  },
106
- "message": {
107
- "name": "message",
128
+ "tool": {
129
+ "name": "tool",
108
130
  "type": "text",
109
131
  "primaryKey": false,
110
132
  "notNull": true,
111
133
  "autoincrement": false
112
134
  },
113
- "file_path": {
114
- "name": "file_path",
135
+ "timestamp": {
136
+ "name": "timestamp",
137
+ "type": "integer",
138
+ "primaryKey": false,
139
+ "notNull": true,
140
+ "autoincrement": false
141
+ },
142
+ "timestamp_iso": {
143
+ "name": "timestamp_iso",
115
144
  "type": "text",
116
145
  "primaryKey": false,
117
146
  "notNull": false,
118
147
  "autoincrement": false
119
148
  },
120
- "line": {
121
- "name": "line",
149
+ "completed_at": {
150
+ "name": "completed_at",
122
151
  "type": "integer",
123
152
  "primaryKey": false,
124
153
  "notNull": false,
125
154
  "autoincrement": false
126
155
  },
127
- "column": {
128
- "name": "column",
129
- "type": "integer",
156
+ "completed_at_iso": {
157
+ "name": "completed_at_iso",
158
+ "type": "text",
130
159
  "primaryKey": false,
131
160
  "notNull": false,
132
161
  "autoincrement": false
133
162
  },
134
- "suggestion": {
135
- "name": "suggestion",
163
+ "cwd": {
164
+ "name": "cwd",
136
165
  "type": "text",
137
166
  "primaryKey": false,
138
- "notNull": false,
167
+ "notNull": true,
139
168
  "autoincrement": false
140
169
  },
141
- "category": {
142
- "name": "category",
170
+ "recipe": {
171
+ "name": "recipe",
143
172
  "type": "text",
144
173
  "primaryKey": false,
145
174
  "notNull": false,
146
175
  "autoincrement": false
176
+ },
177
+ "score": {
178
+ "name": "score",
179
+ "type": "integer",
180
+ "primaryKey": false,
181
+ "notNull": true,
182
+ "autoincrement": false
183
+ },
184
+ "passed": {
185
+ "name": "passed",
186
+ "type": "integer",
187
+ "primaryKey": false,
188
+ "notNull": true,
189
+ "autoincrement": false
190
+ },
191
+ "duration_ms": {
192
+ "name": "duration_ms",
193
+ "type": "integer",
194
+ "primaryKey": false,
195
+ "notNull": true,
196
+ "autoincrement": false
147
197
  }
148
198
  },
149
199
  "indexes": {
150
- "session_findings_check_idx": {
151
- "name": "session_findings_check_idx",
152
- "columns": ["session_check_id"],
200
+ "sessions_tool_timestamp_idx": {
201
+ "name": "sessions_tool_timestamp_idx",
202
+ "columns": ["tool", "\"timestamp\" DESC"],
153
203
  "isUnique": false
154
204
  }
155
205
  },
156
- "foreignKeys": {
157
- "session_findings_session_check_id_session_checks_id_fk": {
158
- "name": "session_findings_session_check_id_session_checks_id_fk",
159
- "tableFrom": "session_findings",
160
- "tableTo": "session_checks",
161
- "columnsFrom": ["session_check_id"],
162
- "columnsTo": ["id"],
163
- "onDelete": "cascade",
164
- "onUpdate": "no action"
165
- }
166
- },
206
+ "foreignKeys": {},
167
207
  "compositePrimaryKeys": {},
168
208
  "uniqueConstraints": {},
169
209
  "checkConstraints": {}
170
210
  },
171
- "sessions": {
172
- "name": "sessions",
211
+ "graph_catalog": {
212
+ "name": "graph_catalog",
173
213
  "columns": {
174
214
  "id": {
175
215
  "name": "id",
216
+ "type": "integer",
217
+ "primaryKey": true,
218
+ "notNull": true,
219
+ "autoincrement": false
220
+ },
221
+ "language": {
222
+ "name": "language",
223
+ "type": "text",
224
+ "primaryKey": false,
225
+ "notNull": true,
226
+ "autoincrement": false
227
+ },
228
+ "cache_key": {
229
+ "name": "cache_key",
230
+ "type": "text",
231
+ "primaryKey": false,
232
+ "notNull": true,
233
+ "autoincrement": false
234
+ },
235
+ "files_fingerprint": {
236
+ "name": "files_fingerprint",
237
+ "type": "text",
238
+ "primaryKey": false,
239
+ "notNull": true,
240
+ "autoincrement": false
241
+ },
242
+ "built_at": {
243
+ "name": "built_at",
244
+ "type": "text",
245
+ "primaryKey": false,
246
+ "notNull": true,
247
+ "autoincrement": false
248
+ },
249
+ "payload": {
250
+ "name": "payload",
251
+ "type": "text",
252
+ "primaryKey": false,
253
+ "notNull": true,
254
+ "autoincrement": false
255
+ }
256
+ },
257
+ "indexes": {},
258
+ "foreignKeys": {},
259
+ "compositePrimaryKeys": {},
260
+ "uniqueConstraints": {},
261
+ "checkConstraints": {}
262
+ },
263
+ "graph_shard_fragment": {
264
+ "name": "graph_shard_fragment",
265
+ "columns": {
266
+ "shard_id": {
267
+ "name": "shard_id",
176
268
  "type": "text",
177
269
  "primaryKey": true,
178
270
  "notNull": true,
179
271
  "autoincrement": false
180
272
  },
273
+ "language": {
274
+ "name": "language",
275
+ "type": "text",
276
+ "primaryKey": false,
277
+ "notNull": true,
278
+ "autoincrement": false
279
+ },
280
+ "cache_key": {
281
+ "name": "cache_key",
282
+ "type": "text",
283
+ "primaryKey": false,
284
+ "notNull": true,
285
+ "autoincrement": false
286
+ },
287
+ "shard_fingerprint": {
288
+ "name": "shard_fingerprint",
289
+ "type": "text",
290
+ "primaryKey": false,
291
+ "notNull": true,
292
+ "autoincrement": false
293
+ },
294
+ "payload": {
295
+ "name": "payload",
296
+ "type": "text",
297
+ "primaryKey": false,
298
+ "notNull": true,
299
+ "autoincrement": false
300
+ }
301
+ },
302
+ "indexes": {},
303
+ "foreignKeys": {},
304
+ "compositePrimaryKeys": {},
305
+ "uniqueConstraints": {},
306
+ "checkConstraints": {}
307
+ },
308
+ "tool_baseline_entries": {
309
+ "name": "tool_baseline_entries",
310
+ "columns": {
181
311
  "tool": {
182
312
  "name": "tool",
183
313
  "type": "text",
@@ -185,65 +315,124 @@
185
315
  "notNull": true,
186
316
  "autoincrement": false
187
317
  },
188
- "timestamp": {
189
- "name": "timestamp",
190
- "type": "integer",
318
+ "stable_id": {
319
+ "name": "stable_id",
320
+ "type": "text",
191
321
  "primaryKey": false,
192
- "notNull": true,
322
+ "notNull": false,
193
323
  "autoincrement": false
194
324
  },
195
- "cwd": {
196
- "name": "cwd",
325
+ "fingerprint": {
326
+ "name": "fingerprint",
197
327
  "type": "text",
198
328
  "primaryKey": false,
199
329
  "notNull": true,
200
330
  "autoincrement": false
201
331
  },
202
- "recipe": {
203
- "name": "recipe",
332
+ "payload": {
333
+ "name": "payload",
204
334
  "type": "text",
205
335
  "primaryKey": false,
206
336
  "notNull": false,
207
337
  "autoincrement": false
208
338
  },
209
- "score": {
210
- "name": "score",
339
+ "captured_at": {
340
+ "name": "captured_at",
211
341
  "type": "integer",
212
342
  "primaryKey": false,
213
343
  "notNull": true,
214
344
  "autoincrement": false
345
+ }
346
+ },
347
+ "indexes": {},
348
+ "foreignKeys": {},
349
+ "compositePrimaryKeys": {
350
+ "tool_baseline_entries_tool_fingerprint_pk": {
351
+ "columns": ["tool", "fingerprint"],
352
+ "name": "tool_baseline_entries_tool_fingerprint_pk"
353
+ }
354
+ },
355
+ "uniqueConstraints": {},
356
+ "checkConstraints": {}
357
+ },
358
+ "tool_baseline_meta": {
359
+ "name": "tool_baseline_meta",
360
+ "columns": {
361
+ "tool": {
362
+ "name": "tool",
363
+ "type": "text",
364
+ "primaryKey": true,
365
+ "notNull": true,
366
+ "autoincrement": false
215
367
  },
216
- "passed": {
217
- "name": "passed",
368
+ "stable_id": {
369
+ "name": "stable_id",
370
+ "type": "text",
371
+ "primaryKey": false,
372
+ "notNull": false,
373
+ "autoincrement": false
374
+ },
375
+ "captured_at": {
376
+ "name": "captured_at",
218
377
  "type": "integer",
219
378
  "primaryKey": false,
220
379
  "notNull": true,
221
380
  "autoincrement": false
381
+ }
382
+ },
383
+ "indexes": {},
384
+ "foreignKeys": {},
385
+ "compositePrimaryKeys": {},
386
+ "uniqueConstraints": {},
387
+ "checkConstraints": {}
388
+ },
389
+ "tool_state": {
390
+ "name": "tool_state",
391
+ "columns": {
392
+ "tool": {
393
+ "name": "tool",
394
+ "type": "text",
395
+ "primaryKey": false,
396
+ "notNull": true,
397
+ "autoincrement": false
398
+ },
399
+ "stable_id": {
400
+ "name": "stable_id",
401
+ "type": "text",
402
+ "primaryKey": false,
403
+ "notNull": false,
404
+ "autoincrement": false
222
405
  },
223
- "summary": {
224
- "name": "summary",
406
+ "key": {
407
+ "name": "key",
225
408
  "type": "text",
226
409
  "primaryKey": false,
227
410
  "notNull": true,
228
411
  "autoincrement": false
229
412
  },
230
- "duration_ms": {
231
- "name": "duration_ms",
413
+ "payload": {
414
+ "name": "payload",
415
+ "type": "text",
416
+ "primaryKey": false,
417
+ "notNull": false,
418
+ "autoincrement": false
419
+ },
420
+ "updated_at": {
421
+ "name": "updated_at",
232
422
  "type": "integer",
233
423
  "primaryKey": false,
234
424
  "notNull": true,
235
425
  "autoincrement": false
236
426
  }
237
427
  },
238
- "indexes": {
239
- "sessions_tool_timestamp_idx": {
240
- "name": "sessions_tool_timestamp_idx",
241
- "columns": ["tool", "\"timestamp\" DESC"],
242
- "isUnique": false
428
+ "indexes": {},
429
+ "foreignKeys": {},
430
+ "compositePrimaryKeys": {
431
+ "tool_state_tool_key_pk": {
432
+ "columns": ["tool", "key"],
433
+ "name": "tool_state_tool_key_pk"
243
434
  }
244
435
  },
245
- "foreignKeys": {},
246
- "compositePrimaryKeys": {},
247
436
  "uniqueConstraints": {},
248
437
  "checkConstraints": {}
249
438
  }