postgresai 0.16.0-rc.4 → 0.16.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 (85) hide show
  1. package/README.md +154 -0
  2. package/dist/bin/postgres-ai.js +2911 -255
  3. package/package.json +12 -3
  4. package/schemas/A002.schema.json +63 -0
  5. package/schemas/A003.schema.json +73 -0
  6. package/schemas/A004.schema.json +81 -0
  7. package/schemas/A007.schema.json +71 -0
  8. package/schemas/A013.schema.json +61 -0
  9. package/schemas/D001.schema.json +71 -0
  10. package/schemas/D004.schema.json +136 -0
  11. package/schemas/F001.schema.json +73 -0
  12. package/schemas/F002.schema.json +108 -0
  13. package/schemas/F003.schema.json +138 -0
  14. package/schemas/F004.schema.json +125 -0
  15. package/schemas/F005.schema.json +131 -0
  16. package/schemas/F009.schema.json +155 -0
  17. package/schemas/G001.schema.json +135 -0
  18. package/schemas/G003.schema.json +90 -0
  19. package/schemas/H001.schema.json +141 -0
  20. package/schemas/H002.schema.json +129 -0
  21. package/schemas/H004.schema.json +128 -0
  22. package/schemas/I001.schema.json +149 -0
  23. package/schemas/K001.schema.json +161 -0
  24. package/schemas/K003.schema.json +163 -0
  25. package/schemas/K004.schema.json +110 -0
  26. package/schemas/K005.schema.json +110 -0
  27. package/schemas/K006.schema.json +110 -0
  28. package/schemas/K007.schema.json +110 -0
  29. package/schemas/K008.schema.json +110 -0
  30. package/schemas/M001.schema.json +119 -0
  31. package/schemas/M002.schema.json +110 -0
  32. package/schemas/M003.schema.json +128 -0
  33. package/schemas/N001.schema.json +161 -0
  34. package/schemas/query.schema.json +62 -0
  35. package/CHANGELOG.md +0 -11
  36. package/bin/postgres-ai.ts +0 -5578
  37. package/bun.lock +0 -258
  38. package/bunfig.toml +0 -20
  39. package/lib/aas-onboard.ts +0 -251
  40. package/lib/auth-server.ts +0 -285
  41. package/lib/checkup-api.ts +0 -526
  42. package/lib/checkup-dictionary.ts +0 -103
  43. package/lib/checkup-summary.ts +0 -338
  44. package/lib/checkup.ts +0 -2261
  45. package/lib/config.ts +0 -171
  46. package/lib/init.ts +0 -1152
  47. package/lib/instances.ts +0 -245
  48. package/lib/issues.ts +0 -1060
  49. package/lib/mcp-server.ts +0 -667
  50. package/lib/metrics-loader.ts +0 -134
  51. package/lib/pkce.ts +0 -79
  52. package/lib/reports.ts +0 -373
  53. package/lib/storage.ts +0 -367
  54. package/lib/supabase.ts +0 -826
  55. package/lib/util.ts +0 -134
  56. package/packages/postgres-ai/README.md +0 -26
  57. package/packages/postgres-ai/bin/postgres-ai.js +0 -27
  58. package/packages/postgres-ai/package.json +0 -27
  59. package/scripts/embed-checkup-dictionary.ts +0 -115
  60. package/scripts/embed-metrics.ts +0 -160
  61. package/scripts/generate-release-notes.ts +0 -668
  62. package/test/PERMISSION_CHECK_TEST_SUMMARY.md +0 -139
  63. package/test/aas-onboard.test.ts +0 -301
  64. package/test/auth.test.ts +0 -287
  65. package/test/checkup.integration.test.ts +0 -413
  66. package/test/checkup.test.ts +0 -3626
  67. package/test/compose-cmd.test.ts +0 -120
  68. package/test/config-consistency.test.ts +0 -352
  69. package/test/init.integration.test.ts +0 -438
  70. package/test/init.test.ts +0 -1816
  71. package/test/issues.cli.test.ts +0 -1162
  72. package/test/issues.test.ts +0 -456
  73. package/test/mcp-server.test.ts +0 -2530
  74. package/test/monitoring.test.ts +0 -746
  75. package/test/permission-check-sql.test.ts +0 -116
  76. package/test/reports.cli.test.ts +0 -793
  77. package/test/reports.test.ts +0 -977
  78. package/test/schema-validation.test.ts +0 -231
  79. package/test/storage.test.ts +0 -935
  80. package/test/supabase.test.ts +0 -709
  81. package/test/targets-add-config.test.ts +0 -28
  82. package/test/test-utils.ts +0 -190
  83. package/test/upgrade.test.ts +0 -1056
  84. package/test/util.test.ts +0 -44
  85. package/tsconfig.json +0 -20
@@ -0,0 +1,110 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "title": "M002 report schema",
4
+ "type": "object",
5
+ "additionalProperties": false,
6
+ "required": ["checkId", "checkTitle", "timestamptz", "nodes", "results"],
7
+ "properties": {
8
+ "contract_version": { "type": ["string", "null"] },
9
+ "summary": { "type": "object", "additionalProperties": false, "required": ["status", "message"], "properties": { "status": { "enum": ["ok", "warning", "info"] }, "message": { "type": "string" } } },
10
+ "version": { "type": ["string", "null"] },
11
+ "build_ts": { "type": ["string", "null"] },
12
+ "generation_mode": { "type": ["string", "null"] },
13
+ "checkId": { "const": "M002" },
14
+ "checkTitle": { "const": "Top queries by rows (I/O intensity)" },
15
+ "timestamptz": { "type": "string" },
16
+ "nodes": { "$ref": "#/$defs/nodes" },
17
+ "results": {
18
+ "type": "object",
19
+ "minProperties": 1,
20
+ "additionalProperties": { "$ref": "#/$defs/nodeResult" }
21
+ }
22
+ },
23
+ "$defs": {
24
+ "nodes": {
25
+ "type": "object",
26
+ "additionalProperties": false,
27
+ "required": ["primary", "standbys"],
28
+ "properties": {
29
+ "primary": { "type": "string" },
30
+ "standbys": { "type": "array", "items": { "type": "string" } }
31
+ }
32
+ },
33
+ "postgresVersion": {
34
+ "type": "object",
35
+ "additionalProperties": false,
36
+ "required": ["version", "server_version_num", "server_major_ver", "server_minor_ver"],
37
+ "properties": {
38
+ "version": { "type": "string" },
39
+ "server_version_num": { "type": "string" },
40
+ "server_major_ver": { "type": "string" },
41
+ "server_minor_ver": { "type": "string" }
42
+ }
43
+ },
44
+ "timeline": {
45
+ "type": "array",
46
+ "items": { "type": "integer" }
47
+ },
48
+ "hourlyNumbers": {
49
+ "type": "array",
50
+ "items": { "type": "number" }
51
+ },
52
+ "queryEntry": {
53
+ "type": "object",
54
+ "additionalProperties": false,
55
+ "required": ["queryid", "total_rows", "hourly_rows"],
56
+ "properties": {
57
+ "queryid": { "type": "string" },
58
+ "total_rows": { "type": "number" },
59
+ "hourly_rows": { "$ref": "#/$defs/hourlyNumbers" }
60
+ }
61
+ },
62
+ "summary": {
63
+ "type": "object",
64
+ "additionalProperties": false,
65
+ "required": [
66
+ "queries_returned",
67
+ "total_rows",
68
+ "total_rows_tracked_queries",
69
+ "total_rows_other",
70
+ "time_range_hours",
71
+ "hourly_timestamps",
72
+ "limit"
73
+ ],
74
+ "properties": {
75
+ "queries_returned": { "type": "integer" },
76
+ "total_rows": { "type": "number" },
77
+ "total_rows_tracked_queries": { "type": "number" },
78
+ "total_rows_other": { "type": "number" },
79
+ "time_range_hours": { "type": "integer" },
80
+ "hourly_timestamps": { "$ref": "#/$defs/timeline" },
81
+ "limit": { "type": "integer" }
82
+ }
83
+ },
84
+ "dbEntry": {
85
+ "type": "object",
86
+ "additionalProperties": false,
87
+ "required": ["top_queries", "other_rows_hourly", "summary"],
88
+ "properties": {
89
+ "top_queries": { "type": "array", "items": { "$ref": "#/$defs/queryEntry" } },
90
+ "other_rows_hourly": { "$ref": "#/$defs/hourlyNumbers" },
91
+ "summary": { "$ref": "#/$defs/summary" }
92
+ }
93
+ },
94
+ "data": {
95
+ "type": "object",
96
+ "additionalProperties": { "$ref": "#/$defs/dbEntry" }
97
+ },
98
+ "nodeResult": {
99
+ "type": "object",
100
+ "additionalProperties": false,
101
+ "required": ["data"],
102
+ "properties": {
103
+ "data": { "$ref": "#/$defs/data" },
104
+ "postgres_version": { "$ref": "#/$defs/postgresVersion" }
105
+ }
106
+ }
107
+ }
108
+ }
109
+
110
+
@@ -0,0 +1,128 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "title": "M003 report schema",
4
+ "type": "object",
5
+ "additionalProperties": false,
6
+ "required": ["checkId", "checkTitle", "timestamptz", "nodes", "results"],
7
+ "properties": {
8
+ "contract_version": { "type": ["string", "null"] },
9
+ "summary": { "type": "object", "additionalProperties": false, "required": ["status", "message"], "properties": { "status": { "enum": ["ok", "warning", "info"] }, "message": { "type": "string" } } },
10
+ "version": { "type": ["string", "null"] },
11
+ "build_ts": { "type": ["string", "null"] },
12
+ "generation_mode": { "type": ["string", "null"] },
13
+ "checkId": { "const": "M003" },
14
+ "checkTitle": { "const": "Top queries by I/O time" },
15
+ "timestamptz": { "type": "string" },
16
+ "nodes": { "$ref": "#/$defs/nodes" },
17
+ "results": {
18
+ "type": "object",
19
+ "minProperties": 1,
20
+ "additionalProperties": { "$ref": "#/$defs/nodeResult" }
21
+ }
22
+ },
23
+ "$defs": {
24
+ "nodes": {
25
+ "type": "object",
26
+ "additionalProperties": false,
27
+ "required": ["primary", "standbys"],
28
+ "properties": {
29
+ "primary": { "type": "string" },
30
+ "standbys": { "type": "array", "items": { "type": "string" } }
31
+ }
32
+ },
33
+ "postgresVersion": {
34
+ "type": "object",
35
+ "additionalProperties": false,
36
+ "required": ["version", "server_version_num", "server_major_ver", "server_minor_ver"],
37
+ "properties": {
38
+ "version": { "type": "string" },
39
+ "server_version_num": { "type": "string" },
40
+ "server_major_ver": { "type": "string" },
41
+ "server_minor_ver": { "type": "string" }
42
+ }
43
+ },
44
+ "timeline": {
45
+ "type": "array",
46
+ "items": { "type": "integer" }
47
+ },
48
+ "hourlyNumbers": {
49
+ "type": "array",
50
+ "items": { "type": "number" }
51
+ },
52
+ "queryEntry": {
53
+ "type": "object",
54
+ "additionalProperties": false,
55
+ "required": [
56
+ "queryid",
57
+ "total_io_time_ms",
58
+ "total_read_time_ms",
59
+ "total_write_time_ms",
60
+ "hourly_io_time_ms",
61
+ "hourly_read_time_ms",
62
+ "hourly_write_time_ms"
63
+ ],
64
+ "properties": {
65
+ "queryid": { "type": "string" },
66
+ "total_io_time_ms": { "type": "number" },
67
+ "total_read_time_ms": { "type": "number" },
68
+ "total_write_time_ms": { "type": "number" },
69
+ "hourly_io_time_ms": { "$ref": "#/$defs/hourlyNumbers" },
70
+ "hourly_read_time_ms": { "$ref": "#/$defs/hourlyNumbers" },
71
+ "hourly_write_time_ms": { "$ref": "#/$defs/hourlyNumbers" }
72
+ }
73
+ },
74
+ "summary": {
75
+ "type": "object",
76
+ "additionalProperties": false,
77
+ "required": [
78
+ "queries_returned",
79
+ "total_io_time_tracked_queries_ms",
80
+ "total_io_time_other_ms",
81
+ "time_range_hours",
82
+ "hourly_timestamps",
83
+ "limit"
84
+ ],
85
+ "properties": {
86
+ "queries_returned": { "type": "integer" },
87
+ "total_io_time_tracked_queries_ms": { "type": "number" },
88
+ "total_io_time_other_ms": { "type": "number" },
89
+ "time_range_hours": { "type": "integer" },
90
+ "hourly_timestamps": { "$ref": "#/$defs/timeline" },
91
+ "limit": { "type": "integer" }
92
+ }
93
+ },
94
+ "dbEntry": {
95
+ "type": "object",
96
+ "additionalProperties": false,
97
+ "required": [
98
+ "top_queries",
99
+ "other_io_time_hourly",
100
+ "other_read_time_hourly",
101
+ "other_write_time_hourly",
102
+ "summary"
103
+ ],
104
+ "properties": {
105
+ "top_queries": { "type": "array", "items": { "$ref": "#/$defs/queryEntry" } },
106
+ "other_io_time_hourly": { "$ref": "#/$defs/hourlyNumbers" },
107
+ "other_read_time_hourly": { "$ref": "#/$defs/hourlyNumbers" },
108
+ "other_write_time_hourly": { "$ref": "#/$defs/hourlyNumbers" },
109
+ "summary": { "$ref": "#/$defs/summary" }
110
+ }
111
+ },
112
+ "data": {
113
+ "type": "object",
114
+ "additionalProperties": { "$ref": "#/$defs/dbEntry" }
115
+ },
116
+ "nodeResult": {
117
+ "type": "object",
118
+ "additionalProperties": false,
119
+ "required": ["data"],
120
+ "properties": {
121
+ "data": { "$ref": "#/$defs/data" },
122
+ "postgres_version": { "$ref": "#/$defs/postgresVersion" }
123
+ }
124
+ }
125
+ }
126
+ }
127
+
128
+
@@ -0,0 +1,161 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "title": "N001 report schema",
4
+ "type": "object",
5
+ "additionalProperties": false,
6
+ "required": ["checkId", "checkTitle", "timestamptz", "nodes", "results"],
7
+ "properties": {
8
+ "contract_version": { "type": ["string", "null"] },
9
+ "summary": { "type": "object", "additionalProperties": false, "required": ["status", "message"], "properties": { "status": { "enum": ["ok", "warning", "info"] }, "message": { "type": "string" } } },
10
+ "version": { "type": ["string", "null"] },
11
+ "build_ts": { "type": ["string", "null"] },
12
+ "generation_mode": { "type": ["string", "null"] },
13
+ "checkId": { "const": "N001" },
14
+ "checkTitle": { "const": "Wait events grouped by type and query" },
15
+ "timestamptz": { "type": "string" },
16
+ "nodes": { "$ref": "#/$defs/nodes" },
17
+ "results": {
18
+ "type": "object",
19
+ "minProperties": 1,
20
+ "additionalProperties": { "$ref": "#/$defs/nodeResult" }
21
+ }
22
+ },
23
+ "$defs": {
24
+ "nodes": {
25
+ "type": "object",
26
+ "additionalProperties": false,
27
+ "required": ["primary", "standbys"],
28
+ "properties": {
29
+ "primary": { "type": "string" },
30
+ "standbys": { "type": "array", "items": { "type": "string" } }
31
+ }
32
+ },
33
+ "postgresVersion": {
34
+ "type": "object",
35
+ "additionalProperties": false,
36
+ "required": ["version", "server_version_num", "server_major_ver", "server_minor_ver"],
37
+ "properties": {
38
+ "version": { "type": "string" },
39
+ "server_version_num": { "type": "string" },
40
+ "server_major_ver": { "type": "string" },
41
+ "server_minor_ver": { "type": "string" }
42
+ }
43
+ },
44
+ "timeline": {
45
+ "type": "array",
46
+ "description": "End timestamps for the one-hour buckets. Each value describes the preceding hour.",
47
+ "items": { "type": "integer" }
48
+ },
49
+ "hourlyIntegers": {
50
+ "type": "array",
51
+ "description": "Sampled active-session ticks per hour, not distinct wait-event starts.",
52
+ "items": { "type": "integer" }
53
+ },
54
+ "waitEventEntry": {
55
+ "type": "object",
56
+ "additionalProperties": false,
57
+ "required": ["occurrences"],
58
+ "properties": {
59
+ "occurrences": {
60
+ "type": "integer",
61
+ "description": "Sampled active-session ticks, not distinct wait-event starts."
62
+ }
63
+ }
64
+ },
65
+ "queryEntry": {
66
+ "type": "object",
67
+ "additionalProperties": false,
68
+ "required": ["query_id", "occurrences", "hourly_occurrences", "wait_events"],
69
+ "properties": {
70
+ "query_id": { "type": "string" },
71
+ "occurrences": {
72
+ "type": "integer",
73
+ "description": "Sampled active-session ticks, not distinct wait-event starts."
74
+ },
75
+ "hourly_occurrences": { "$ref": "#/$defs/hourlyIntegers" },
76
+ "wait_events": {
77
+ "type": "object",
78
+ "additionalProperties": { "$ref": "#/$defs/waitEventEntry" }
79
+ }
80
+ }
81
+ },
82
+ "waitTypeEntry": {
83
+ "type": "object",
84
+ "additionalProperties": false,
85
+ "required": ["total_occurrences", "unique_queries", "queries_list"],
86
+ "properties": {
87
+ "total_occurrences": {
88
+ "type": "integer",
89
+ "description": "Sampled active-session ticks, not distinct wait-event starts."
90
+ },
91
+ "unique_queries": { "type": "integer" },
92
+ "queries_list": { "type": "array", "items": { "$ref": "#/$defs/queryEntry" } }
93
+ }
94
+ },
95
+ "summary": {
96
+ "type": "object",
97
+ "additionalProperties": false,
98
+ "required": [
99
+ "time_range_hours",
100
+ "start_time",
101
+ "end_time",
102
+ "wait_event_types_count",
103
+ "total_occurrences",
104
+ "hourly_timestamps",
105
+ "sampling_semantics",
106
+ "sampling_note"
107
+ ],
108
+ "properties": {
109
+ "time_range_hours": { "type": "integer" },
110
+ "start_time": {
111
+ "type": "string",
112
+ "description": "Start of the first one-hour bucket."
113
+ },
114
+ "end_time": {
115
+ "type": "string",
116
+ "description": "End of the final one-hour bucket."
117
+ },
118
+ "wait_event_types_count": { "type": "integer" },
119
+ "total_occurrences": {
120
+ "type": "integer",
121
+ "description": "Sampled active-session ticks, not distinct wait-event starts."
122
+ },
123
+ "hourly_timestamps": { "$ref": "#/$defs/timeline" },
124
+ "sampling_semantics": {
125
+ "const": "sampled_active_session_ticks",
126
+ "description": "Identifies the cadence-dependent measurement represented by occurrence fields."
127
+ },
128
+ "sampling_note": {
129
+ "type": "string",
130
+ "minLength": 1,
131
+ "description": "Explains cadence, scrape-gap, and non-event-count limitations."
132
+ }
133
+ }
134
+ },
135
+ "dbEntry": {
136
+ "type": "object",
137
+ "additionalProperties": false,
138
+ "required": ["wait_event_types", "summary"],
139
+ "properties": {
140
+ "wait_event_types": {
141
+ "type": "object",
142
+ "additionalProperties": { "$ref": "#/$defs/waitTypeEntry" }
143
+ },
144
+ "summary": { "$ref": "#/$defs/summary" }
145
+ }
146
+ },
147
+ "data": {
148
+ "type": "object",
149
+ "additionalProperties": { "$ref": "#/$defs/dbEntry" }
150
+ },
151
+ "nodeResult": {
152
+ "type": "object",
153
+ "additionalProperties": false,
154
+ "required": ["data"],
155
+ "properties": {
156
+ "data": { "$ref": "#/$defs/data" },
157
+ "postgres_version": { "$ref": "#/$defs/postgresVersion" }
158
+ }
159
+ }
160
+ }
161
+ }
@@ -0,0 +1,62 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "title": "Per-query report file schema",
4
+ "type": "object",
5
+ "additionalProperties": false,
6
+ "required": ["cluster_id", "query_id", "query_text", "nodes", "results", "timestamptz"],
7
+ "properties": {
8
+ "cluster_id": { "type": "string", "minLength": 1 },
9
+ "query_id": { "type": "string", "minLength": 1 },
10
+ "query_text": { "type": ["string", "null"] },
11
+ "nodes": { "$ref": "#/$defs/nodes" },
12
+ "results": { "$ref": "#/$defs/results" },
13
+ "time_range": { "$ref": "#/$defs/timeRange" },
14
+ "timestamptz": { "type": "string" }
15
+ },
16
+ "$defs": {
17
+ "nodes": {
18
+ "type": "object",
19
+ "additionalProperties": false,
20
+ "required": ["primary", "standbys"],
21
+ "properties": {
22
+ "primary": { "type": ["string", "null"] },
23
+ "standbys": { "type": "array", "items": { "type": "string" } }
24
+ }
25
+ },
26
+ "timeRange": {
27
+ "type": "object",
28
+ "additionalProperties": false,
29
+ "required": ["hours", "start_time", "end_time"],
30
+ "properties": {
31
+ "hours": { "type": "integer", "minimum": 1 },
32
+ "start_time": { "type": "string" },
33
+ "end_time": { "type": "string" }
34
+ }
35
+ },
36
+ "metricValue": { "type": ["number", "integer"] },
37
+ "metrics": {
38
+ "type": "object",
39
+ "additionalProperties": { "$ref": "#/$defs/metricValue" }
40
+ },
41
+ "dbEntry": {
42
+ "type": "object",
43
+ "additionalProperties": false,
44
+ "required": ["metrics"],
45
+ "properties": {
46
+ "metrics": { "$ref": "#/$defs/metrics" }
47
+ }
48
+ },
49
+ "nodeEntry": {
50
+ "type": "object",
51
+ "minProperties": 1,
52
+ "additionalProperties": { "$ref": "#/$defs/dbEntry" }
53
+ },
54
+ "results": {
55
+ "type": "object",
56
+ "minProperties": 1,
57
+ "additionalProperties": { "$ref": "#/$defs/nodeEntry" }
58
+ }
59
+ }
60
+ }
61
+
62
+
package/CHANGELOG.md DELETED
@@ -1,11 +0,0 @@
1
- # Changelog
2
-
3
- ## Unreleased
4
-
5
- ### Fixed
6
-
7
- - `checkup --markdown` previously performed server-side conversion and sent the
8
- full report JSON to the PostgresAI API even when `--no-upload` was set. The
9
- flags are now mutually exclusive, and `--no-upload` prevents report data from
10
- being sent to the PostgresAI API. Use `--json` or `--output` for local-only
11
- output.