postgresai 0.12.0-beta.7 → 0.14.0-beta.10
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.
- package/README.md +154 -53
- package/bin/postgres-ai.ts +1572 -350
- package/bun.lock +258 -0
- package/bunfig.toml +20 -0
- package/dist/bin/postgres-ai.js +28575 -1487
- package/dist/sql/01.role.sql +16 -0
- package/dist/sql/02.permissions.sql +37 -0
- package/dist/sql/03.optional_rds.sql +6 -0
- package/dist/sql/04.optional_self_managed.sql +8 -0
- package/dist/sql/05.helpers.sql +439 -0
- package/dist/sql/sql/01.role.sql +16 -0
- package/dist/sql/sql/02.permissions.sql +37 -0
- package/dist/sql/sql/03.optional_rds.sql +6 -0
- package/dist/sql/sql/04.optional_self_managed.sql +8 -0
- package/dist/sql/sql/05.helpers.sql +439 -0
- package/lib/auth-server.ts +124 -106
- package/lib/checkup-api.ts +386 -0
- package/lib/checkup.ts +1330 -0
- package/lib/config.ts +6 -3
- package/lib/init.ts +760 -0
- package/lib/issues.ts +400 -191
- package/lib/mcp-server.ts +213 -90
- package/lib/metrics-embedded.ts +79 -0
- package/lib/metrics-loader.ts +127 -0
- package/lib/util.ts +61 -0
- package/package.json +20 -9
- package/packages/postgres-ai/README.md +26 -0
- package/packages/postgres-ai/bin/postgres-ai.js +27 -0
- package/packages/postgres-ai/package.json +27 -0
- package/scripts/embed-metrics.ts +154 -0
- package/sql/01.role.sql +16 -0
- package/sql/02.permissions.sql +37 -0
- package/sql/03.optional_rds.sql +6 -0
- package/sql/04.optional_self_managed.sql +8 -0
- package/sql/05.helpers.sql +439 -0
- package/test/auth.test.ts +258 -0
- package/test/checkup.integration.test.ts +321 -0
- package/test/checkup.test.ts +891 -0
- package/test/init.integration.test.ts +499 -0
- package/test/init.test.ts +417 -0
- package/test/issues.cli.test.ts +314 -0
- package/test/issues.test.ts +456 -0
- package/test/mcp-server.test.ts +988 -0
- package/test/schema-validation.test.ts +81 -0
- package/test/test-utils.ts +122 -0
- package/tsconfig.json +12 -20
- package/dist/bin/postgres-ai.d.ts +0 -3
- package/dist/bin/postgres-ai.d.ts.map +0 -1
- package/dist/bin/postgres-ai.js.map +0 -1
- package/dist/lib/auth-server.d.ts +0 -31
- package/dist/lib/auth-server.d.ts.map +0 -1
- package/dist/lib/auth-server.js +0 -263
- package/dist/lib/auth-server.js.map +0 -1
- package/dist/lib/config.d.ts +0 -45
- package/dist/lib/config.d.ts.map +0 -1
- package/dist/lib/config.js +0 -181
- package/dist/lib/config.js.map +0 -1
- package/dist/lib/issues.d.ts +0 -75
- package/dist/lib/issues.d.ts.map +0 -1
- package/dist/lib/issues.js +0 -336
- package/dist/lib/issues.js.map +0 -1
- package/dist/lib/mcp-server.d.ts +0 -9
- package/dist/lib/mcp-server.d.ts.map +0 -1
- package/dist/lib/mcp-server.js +0 -168
- package/dist/lib/mcp-server.js.map +0 -1
- package/dist/lib/pkce.d.ts +0 -32
- package/dist/lib/pkce.d.ts.map +0 -1
- package/dist/lib/pkce.js +0 -101
- package/dist/lib/pkce.js.map +0 -1
- package/dist/lib/util.d.ts +0 -27
- package/dist/lib/util.d.ts.map +0 -1
- package/dist/lib/util.js +0 -46
- package/dist/lib/util.js.map +0 -1
- package/dist/package.json +0 -45
package/dist/lib/auth-server.js
DELETED
|
@@ -1,263 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.createCallbackServer = createCallbackServer;
|
|
37
|
-
exports.getServerPort = getServerPort;
|
|
38
|
-
const http = __importStar(require("http"));
|
|
39
|
-
const url_1 = require("url");
|
|
40
|
-
/**
|
|
41
|
-
* Simple HTML escape utility
|
|
42
|
-
* @param str - String to escape
|
|
43
|
-
* @returns Escaped string
|
|
44
|
-
*/
|
|
45
|
-
function escapeHtml(str) {
|
|
46
|
-
if (!str)
|
|
47
|
-
return "";
|
|
48
|
-
return String(str)
|
|
49
|
-
.replace(/&/g, "&")
|
|
50
|
-
.replace(/</g, "<")
|
|
51
|
-
.replace(/>/g, ">")
|
|
52
|
-
.replace(/"/g, """)
|
|
53
|
-
.replace(/'/g, "'");
|
|
54
|
-
}
|
|
55
|
-
/**
|
|
56
|
-
* Create and start callback server, returning server object and promise
|
|
57
|
-
* @param port - Port to listen on (0 for random available port)
|
|
58
|
-
* @param expectedState - Expected state parameter for CSRF protection
|
|
59
|
-
* @param timeoutMs - Timeout in milliseconds
|
|
60
|
-
* @returns Server object with promise and getPort function
|
|
61
|
-
*/
|
|
62
|
-
function createCallbackServer(port = 0, expectedState = null, timeoutMs = 300000) {
|
|
63
|
-
let resolved = false;
|
|
64
|
-
let server = null;
|
|
65
|
-
let actualPort = port;
|
|
66
|
-
let resolveCallback;
|
|
67
|
-
let rejectCallback;
|
|
68
|
-
const promise = new Promise((resolve, reject) => {
|
|
69
|
-
resolveCallback = resolve;
|
|
70
|
-
rejectCallback = reject;
|
|
71
|
-
});
|
|
72
|
-
// Timeout handler
|
|
73
|
-
const timeout = setTimeout(() => {
|
|
74
|
-
if (!resolved) {
|
|
75
|
-
resolved = true;
|
|
76
|
-
if (server) {
|
|
77
|
-
server.close();
|
|
78
|
-
}
|
|
79
|
-
rejectCallback(new Error("Authentication timeout. Please try again."));
|
|
80
|
-
}
|
|
81
|
-
}, timeoutMs);
|
|
82
|
-
// Request handler
|
|
83
|
-
const requestHandler = (req, res) => {
|
|
84
|
-
if (resolved) {
|
|
85
|
-
return;
|
|
86
|
-
}
|
|
87
|
-
// Only handle /callback path
|
|
88
|
-
if (!req.url || !req.url.startsWith("/callback")) {
|
|
89
|
-
res.writeHead(404, { "Content-Type": "text/plain" });
|
|
90
|
-
res.end("Not Found");
|
|
91
|
-
return;
|
|
92
|
-
}
|
|
93
|
-
try {
|
|
94
|
-
const url = new url_1.URL(req.url, `http://localhost:${actualPort}`);
|
|
95
|
-
const code = url.searchParams.get("code");
|
|
96
|
-
const state = url.searchParams.get("state");
|
|
97
|
-
const error = url.searchParams.get("error");
|
|
98
|
-
const errorDescription = url.searchParams.get("error_description");
|
|
99
|
-
// Handle OAuth error
|
|
100
|
-
if (error) {
|
|
101
|
-
resolved = true;
|
|
102
|
-
clearTimeout(timeout);
|
|
103
|
-
res.writeHead(400, { "Content-Type": "text/html" });
|
|
104
|
-
res.end(`
|
|
105
|
-
<!DOCTYPE html>
|
|
106
|
-
<html>
|
|
107
|
-
<head>
|
|
108
|
-
<title>Authentication failed</title>
|
|
109
|
-
<style>
|
|
110
|
-
body { font-family: system-ui, -apple-system, sans-serif; max-width: 600px; margin: 50px auto; padding: 20px; }
|
|
111
|
-
.error { background: #fee; border: 1px solid #fcc; padding: 20px; border-radius: 8px; }
|
|
112
|
-
h1 { color: #c33; margin-top: 0; }
|
|
113
|
-
code { background: #f5f5f5; padding: 2px 6px; border-radius: 3px; }
|
|
114
|
-
</style>
|
|
115
|
-
</head>
|
|
116
|
-
<body>
|
|
117
|
-
<div class="error">
|
|
118
|
-
<h1>Authentication failed</h1>
|
|
119
|
-
<p><strong>Error:</strong> ${escapeHtml(error)}</p>
|
|
120
|
-
${errorDescription ? `<p><strong>Description:</strong> ${escapeHtml(errorDescription)}</p>` : ""}
|
|
121
|
-
<p>You can close this window and return to your terminal.</p>
|
|
122
|
-
</div>
|
|
123
|
-
</body>
|
|
124
|
-
</html>
|
|
125
|
-
`);
|
|
126
|
-
if (server) {
|
|
127
|
-
server.close();
|
|
128
|
-
}
|
|
129
|
-
rejectCallback(new Error(`OAuth error: ${error}${errorDescription ? ` - ${errorDescription}` : ""}`));
|
|
130
|
-
return;
|
|
131
|
-
}
|
|
132
|
-
// Validate required parameters
|
|
133
|
-
if (!code || !state) {
|
|
134
|
-
res.writeHead(400, { "Content-Type": "text/html" });
|
|
135
|
-
res.end(`
|
|
136
|
-
<!DOCTYPE html>
|
|
137
|
-
<html>
|
|
138
|
-
<head>
|
|
139
|
-
<title>Authentication failed</title>
|
|
140
|
-
<style>
|
|
141
|
-
body { font-family: system-ui, -apple-system, sans-serif; max-width: 600px; margin: 50px auto; padding: 20px; }
|
|
142
|
-
.error { background: #fee; border: 1px solid #fcc; padding: 20px; border-radius: 8px; }
|
|
143
|
-
h1 { color: #c33; margin-top: 0; }
|
|
144
|
-
</style>
|
|
145
|
-
</head>
|
|
146
|
-
<body>
|
|
147
|
-
<div class="error">
|
|
148
|
-
<h1>Authentication failed</h1>
|
|
149
|
-
<p>Missing required parameters (code or state).</p>
|
|
150
|
-
<p>You can close this window and return to your terminal.</p>
|
|
151
|
-
</div>
|
|
152
|
-
</body>
|
|
153
|
-
</html>
|
|
154
|
-
`);
|
|
155
|
-
return;
|
|
156
|
-
}
|
|
157
|
-
// Validate state (CSRF protection)
|
|
158
|
-
if (expectedState && state !== expectedState) {
|
|
159
|
-
resolved = true;
|
|
160
|
-
clearTimeout(timeout);
|
|
161
|
-
res.writeHead(400, { "Content-Type": "text/html" });
|
|
162
|
-
res.end(`
|
|
163
|
-
<!DOCTYPE html>
|
|
164
|
-
<html>
|
|
165
|
-
<head>
|
|
166
|
-
<title>Authentication failed</title>
|
|
167
|
-
<style>
|
|
168
|
-
body { font-family: system-ui, -apple-system, sans-serif; max-width: 600px; margin: 50px auto; padding: 20px; }
|
|
169
|
-
.error { background: #fee; border: 1px solid #fcc; padding: 20px; border-radius: 8px; }
|
|
170
|
-
h1 { color: #c33; margin-top: 0; }
|
|
171
|
-
</style>
|
|
172
|
-
</head>
|
|
173
|
-
<body>
|
|
174
|
-
<div class="error">
|
|
175
|
-
<h1>Authentication failed</h1>
|
|
176
|
-
<p>Invalid state parameter (possible CSRF attack).</p>
|
|
177
|
-
<p>You can close this window and return to your terminal.</p>
|
|
178
|
-
</div>
|
|
179
|
-
</body>
|
|
180
|
-
</html>
|
|
181
|
-
`);
|
|
182
|
-
if (server) {
|
|
183
|
-
server.close();
|
|
184
|
-
}
|
|
185
|
-
rejectCallback(new Error("State mismatch (possible CSRF attack)"));
|
|
186
|
-
return;
|
|
187
|
-
}
|
|
188
|
-
// Success!
|
|
189
|
-
resolved = true;
|
|
190
|
-
clearTimeout(timeout);
|
|
191
|
-
res.writeHead(200, { "Content-Type": "text/html" });
|
|
192
|
-
res.end(`
|
|
193
|
-
<!DOCTYPE html>
|
|
194
|
-
<html>
|
|
195
|
-
<head>
|
|
196
|
-
<title>Authentication successful</title>
|
|
197
|
-
<style>
|
|
198
|
-
body { font-family: system-ui, -apple-system, sans-serif; max-width: 600px; margin: 50px auto; padding: 20px; }
|
|
199
|
-
.success { background: #efe; border: 1px solid #cfc; padding: 20px; border-radius: 8px; }
|
|
200
|
-
h1 { color: #3c3; margin-top: 0; }
|
|
201
|
-
</style>
|
|
202
|
-
</head>
|
|
203
|
-
<body>
|
|
204
|
-
<div class="success">
|
|
205
|
-
<h1>Authentication successful</h1>
|
|
206
|
-
<p>You have successfully authenticated the PostgresAI CLI.</p>
|
|
207
|
-
<p>You can close this window and return to your terminal.</p>
|
|
208
|
-
</div>
|
|
209
|
-
</body>
|
|
210
|
-
</html>
|
|
211
|
-
`);
|
|
212
|
-
if (server) {
|
|
213
|
-
server.close();
|
|
214
|
-
}
|
|
215
|
-
resolveCallback({ code, state });
|
|
216
|
-
}
|
|
217
|
-
catch (err) {
|
|
218
|
-
if (!resolved) {
|
|
219
|
-
resolved = true;
|
|
220
|
-
clearTimeout(timeout);
|
|
221
|
-
res.writeHead(500, { "Content-Type": "text/plain" });
|
|
222
|
-
res.end("Internal Server Error");
|
|
223
|
-
if (server) {
|
|
224
|
-
server.close();
|
|
225
|
-
}
|
|
226
|
-
rejectCallback(err instanceof Error ? err : new Error(String(err)));
|
|
227
|
-
}
|
|
228
|
-
}
|
|
229
|
-
};
|
|
230
|
-
// Create server
|
|
231
|
-
server = http.createServer(requestHandler);
|
|
232
|
-
server.on("error", (err) => {
|
|
233
|
-
if (!resolved) {
|
|
234
|
-
resolved = true;
|
|
235
|
-
clearTimeout(timeout);
|
|
236
|
-
rejectCallback(err);
|
|
237
|
-
}
|
|
238
|
-
});
|
|
239
|
-
server.listen(port, "127.0.0.1", () => {
|
|
240
|
-
const address = server?.address();
|
|
241
|
-
if (address && typeof address === "object") {
|
|
242
|
-
actualPort = address.port;
|
|
243
|
-
}
|
|
244
|
-
});
|
|
245
|
-
return {
|
|
246
|
-
server,
|
|
247
|
-
promise,
|
|
248
|
-
getPort: () => {
|
|
249
|
-
const address = server?.address();
|
|
250
|
-
return address && typeof address === "object" ? address.port : 0;
|
|
251
|
-
},
|
|
252
|
-
};
|
|
253
|
-
}
|
|
254
|
-
/**
|
|
255
|
-
* Get the actual port the server is listening on
|
|
256
|
-
* @param server - HTTP server instance
|
|
257
|
-
* @returns Port number
|
|
258
|
-
*/
|
|
259
|
-
function getServerPort(server) {
|
|
260
|
-
const address = server.address();
|
|
261
|
-
return address && typeof address === "object" ? address.port : 0;
|
|
262
|
-
}
|
|
263
|
-
//# sourceMappingURL=auth-server.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"auth-server.js","sourceRoot":"","sources":["../../lib/auth-server.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0CA,oDAqNC;AAOD,sCAGC;AAzQD,2CAA6B;AAC7B,6BAA0B;AAmB1B;;;;GAIG;AACH,SAAS,UAAU,CAAC,GAAkB;IACpC,IAAI,CAAC,GAAG;QAAE,OAAO,EAAE,CAAC;IACpB,OAAO,MAAM,CAAC,GAAG,CAAC;SACf,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC;SACtB,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC;SACrB,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC;SACrB,OAAO,CAAC,IAAI,EAAE,QAAQ,CAAC;SACvB,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;AAC5B,CAAC;AAED;;;;;;GAMG;AACH,SAAgB,oBAAoB,CAClC,OAAe,CAAC,EAChB,gBAA+B,IAAI,EACnC,YAAoB,MAAM;IAE1B,IAAI,QAAQ,GAAG,KAAK,CAAC;IACrB,IAAI,MAAM,GAAuB,IAAI,CAAC;IACtC,IAAI,UAAU,GAAG,IAAI,CAAC;IACtB,IAAI,eAAgD,CAAC;IACrD,IAAI,cAAuC,CAAC;IAE5C,MAAM,OAAO,GAAG,IAAI,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AO,EAAE,CAAC,GAAU,EAAE,EAAE;QAChC,IAAI,CAAC,QAAQ,EAAE,CAAC;YACd,QAAQ,GAAG,IAAI,CAAC;YAChB,YAAY,CAAC,OAAO,CAAC,CAAC;YACtB,cAAc,CAAC,GAAG,CAAC,CAAC;QACtB,CAAC;IACH,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,WAAW,EAAE,GAAG,EAAE;QACpC,MAAM,OAAO,GAAG,MAAM,EAAE,OAAO,EAAE,CAAC;QAClC,IAAI,OAAO,IAAI,OAAO,OAAO,KAAK,QAAQ,EAAE,CAAC;YAC3C,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC;QAC5B,CAAC;IACH,CAAC,CAAC,CAAC;IAEH,OAAO;QACL,MAAM;QACN,OAAO;QACP,OAAO,EAAE,GAAG,EAAE;YACZ,MAAM,OAAO,GAAG,MAAM,EAAE,OAAO,EAAE,CAAC;YAClC,OAAO,OAAO,IAAI,OAAO,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;QACnE,CAAC;KACF,CAAC;AACJ,CAAC;AAED;;;;GAIG;AACH,SAAgB,aAAa,CAAC,MAAmB;IAC/C,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,EAAE,CAAC;IACjC,OAAO,OAAO,IAAI,OAAO,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;AACnE,CAAC"}
|
package/dist/lib/config.d.ts
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Configuration object structure
|
|
3
|
-
*/
|
|
4
|
-
export interface Config {
|
|
5
|
-
apiKey: string | null;
|
|
6
|
-
baseUrl: string | null;
|
|
7
|
-
orgId: number | null;
|
|
8
|
-
}
|
|
9
|
-
/**
|
|
10
|
-
* Get the user-level config directory path
|
|
11
|
-
* @returns Path to ~/.config/postgresai
|
|
12
|
-
*/
|
|
13
|
-
export declare function getConfigDir(): string;
|
|
14
|
-
/**
|
|
15
|
-
* Get the user-level config file path
|
|
16
|
-
* @returns Path to ~/.config/postgresai/config.json
|
|
17
|
-
*/
|
|
18
|
-
export declare function getConfigPath(): string;
|
|
19
|
-
/**
|
|
20
|
-
* Get the legacy project-local config file path
|
|
21
|
-
* @returns Path to .pgwatch-config in current directory
|
|
22
|
-
*/
|
|
23
|
-
export declare function getLegacyConfigPath(): string;
|
|
24
|
-
/**
|
|
25
|
-
* Read configuration from file
|
|
26
|
-
* Tries user-level config first, then falls back to legacy project-local config
|
|
27
|
-
* @returns Configuration object with apiKey, baseUrl, orgId
|
|
28
|
-
*/
|
|
29
|
-
export declare function readConfig(): Config;
|
|
30
|
-
/**
|
|
31
|
-
* Write configuration to user-level config file
|
|
32
|
-
* @param config - Configuration object with apiKey, baseUrl, orgId
|
|
33
|
-
*/
|
|
34
|
-
export declare function writeConfig(config: Partial<Config>): void;
|
|
35
|
-
/**
|
|
36
|
-
* Delete specific keys from configuration
|
|
37
|
-
* @param keys - Array of keys to delete (e.g., ['apiKey'])
|
|
38
|
-
*/
|
|
39
|
-
export declare function deleteConfigKeys(keys: string[]): void;
|
|
40
|
-
/**
|
|
41
|
-
* Check if config file exists
|
|
42
|
-
* @returns True if config exists
|
|
43
|
-
*/
|
|
44
|
-
export declare function configExists(): boolean;
|
|
45
|
-
//# sourceMappingURL=config.d.ts.map
|
package/dist/lib/config.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../lib/config.ts"],"names":[],"mappings":"AAIA;;GAEG;AACH,MAAM,WAAW,MAAM;IACrB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;CACtB;AAED;;;GAGG;AACH,wBAAgB,YAAY,IAAI,MAAM,CAGrC;AAED;;;GAGG;AACH,wBAAgB,aAAa,IAAI,MAAM,CAEtC;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,IAAI,MAAM,CAE5C;AAED;;;;GAIG;AACH,wBAAgB,UAAU,IAAI,MAAM,CA8CnC;AAED;;;GAGG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,OAAO,CAAC,MAAM,CAAC,GAAG,IAAI,CA6BzD;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,IAAI,CAqBrD;AAED;;;GAGG;AACH,wBAAgB,YAAY,IAAI,OAAO,CAEtC"}
|
package/dist/lib/config.js
DELETED
|
@@ -1,181 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.getConfigDir = getConfigDir;
|
|
37
|
-
exports.getConfigPath = getConfigPath;
|
|
38
|
-
exports.getLegacyConfigPath = getLegacyConfigPath;
|
|
39
|
-
exports.readConfig = readConfig;
|
|
40
|
-
exports.writeConfig = writeConfig;
|
|
41
|
-
exports.deleteConfigKeys = deleteConfigKeys;
|
|
42
|
-
exports.configExists = configExists;
|
|
43
|
-
const fs = __importStar(require("fs"));
|
|
44
|
-
const path = __importStar(require("path"));
|
|
45
|
-
const os = __importStar(require("os"));
|
|
46
|
-
/**
|
|
47
|
-
* Get the user-level config directory path
|
|
48
|
-
* @returns Path to ~/.config/postgresai
|
|
49
|
-
*/
|
|
50
|
-
function getConfigDir() {
|
|
51
|
-
const configHome = process.env.XDG_CONFIG_HOME || path.join(os.homedir(), ".config");
|
|
52
|
-
return path.join(configHome, "postgresai");
|
|
53
|
-
}
|
|
54
|
-
/**
|
|
55
|
-
* Get the user-level config file path
|
|
56
|
-
* @returns Path to ~/.config/postgresai/config.json
|
|
57
|
-
*/
|
|
58
|
-
function getConfigPath() {
|
|
59
|
-
return path.join(getConfigDir(), "config.json");
|
|
60
|
-
}
|
|
61
|
-
/**
|
|
62
|
-
* Get the legacy project-local config file path
|
|
63
|
-
* @returns Path to .pgwatch-config in current directory
|
|
64
|
-
*/
|
|
65
|
-
function getLegacyConfigPath() {
|
|
66
|
-
return path.resolve(process.cwd(), ".pgwatch-config");
|
|
67
|
-
}
|
|
68
|
-
/**
|
|
69
|
-
* Read configuration from file
|
|
70
|
-
* Tries user-level config first, then falls back to legacy project-local config
|
|
71
|
-
* @returns Configuration object with apiKey, baseUrl, orgId
|
|
72
|
-
*/
|
|
73
|
-
function readConfig() {
|
|
74
|
-
const config = {
|
|
75
|
-
apiKey: null,
|
|
76
|
-
baseUrl: null,
|
|
77
|
-
orgId: null,
|
|
78
|
-
};
|
|
79
|
-
// Try user-level config first
|
|
80
|
-
const userConfigPath = getConfigPath();
|
|
81
|
-
if (fs.existsSync(userConfigPath)) {
|
|
82
|
-
try {
|
|
83
|
-
const content = fs.readFileSync(userConfigPath, "utf8");
|
|
84
|
-
const parsed = JSON.parse(content);
|
|
85
|
-
config.apiKey = parsed.apiKey || null;
|
|
86
|
-
config.baseUrl = parsed.baseUrl || null;
|
|
87
|
-
config.orgId = parsed.orgId || null;
|
|
88
|
-
return config;
|
|
89
|
-
}
|
|
90
|
-
catch (err) {
|
|
91
|
-
const message = err instanceof Error ? err.message : String(err);
|
|
92
|
-
console.error(`Warning: Failed to read config from ${userConfigPath}: ${message}`);
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
// Fall back to legacy project-local config
|
|
96
|
-
const legacyPath = getLegacyConfigPath();
|
|
97
|
-
if (fs.existsSync(legacyPath)) {
|
|
98
|
-
try {
|
|
99
|
-
const stats = fs.statSync(legacyPath);
|
|
100
|
-
if (stats.isFile()) {
|
|
101
|
-
const content = fs.readFileSync(legacyPath, "utf8");
|
|
102
|
-
const lines = content.split(/\r?\n/);
|
|
103
|
-
for (const line of lines) {
|
|
104
|
-
const match = line.match(/^api_key=(.+)$/);
|
|
105
|
-
if (match) {
|
|
106
|
-
config.apiKey = match[1].trim();
|
|
107
|
-
break;
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
catch (err) {
|
|
113
|
-
const message = err instanceof Error ? err.message : String(err);
|
|
114
|
-
console.error(`Warning: Failed to read legacy config from ${legacyPath}: ${message}`);
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
return config;
|
|
118
|
-
}
|
|
119
|
-
/**
|
|
120
|
-
* Write configuration to user-level config file
|
|
121
|
-
* @param config - Configuration object with apiKey, baseUrl, orgId
|
|
122
|
-
*/
|
|
123
|
-
function writeConfig(config) {
|
|
124
|
-
const configDir = getConfigDir();
|
|
125
|
-
const configPath = getConfigPath();
|
|
126
|
-
// Ensure config directory exists
|
|
127
|
-
if (!fs.existsSync(configDir)) {
|
|
128
|
-
fs.mkdirSync(configDir, { recursive: true, mode: 0o700 });
|
|
129
|
-
}
|
|
130
|
-
// Read existing config and merge
|
|
131
|
-
let existingConfig = {};
|
|
132
|
-
if (fs.existsSync(configPath)) {
|
|
133
|
-
try {
|
|
134
|
-
const content = fs.readFileSync(configPath, "utf8");
|
|
135
|
-
existingConfig = JSON.parse(content);
|
|
136
|
-
}
|
|
137
|
-
catch (err) {
|
|
138
|
-
// Ignore parse errors, will overwrite
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
const mergedConfig = {
|
|
142
|
-
...existingConfig,
|
|
143
|
-
...config,
|
|
144
|
-
};
|
|
145
|
-
// Write config file with restricted permissions
|
|
146
|
-
fs.writeFileSync(configPath, JSON.stringify(mergedConfig, null, 2) + "\n", {
|
|
147
|
-
mode: 0o600,
|
|
148
|
-
});
|
|
149
|
-
}
|
|
150
|
-
/**
|
|
151
|
-
* Delete specific keys from configuration
|
|
152
|
-
* @param keys - Array of keys to delete (e.g., ['apiKey'])
|
|
153
|
-
*/
|
|
154
|
-
function deleteConfigKeys(keys) {
|
|
155
|
-
const configPath = getConfigPath();
|
|
156
|
-
if (!fs.existsSync(configPath)) {
|
|
157
|
-
return;
|
|
158
|
-
}
|
|
159
|
-
try {
|
|
160
|
-
const content = fs.readFileSync(configPath, "utf8");
|
|
161
|
-
const config = JSON.parse(content);
|
|
162
|
-
for (const key of keys) {
|
|
163
|
-
delete config[key];
|
|
164
|
-
}
|
|
165
|
-
fs.writeFileSync(configPath, JSON.stringify(config, null, 2) + "\n", {
|
|
166
|
-
mode: 0o600,
|
|
167
|
-
});
|
|
168
|
-
}
|
|
169
|
-
catch (err) {
|
|
170
|
-
const message = err instanceof Error ? err.message : String(err);
|
|
171
|
-
console.error(`Warning: Failed to update config: ${message}`);
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
/**
|
|
175
|
-
* Check if config file exists
|
|
176
|
-
* @returns True if config exists
|
|
177
|
-
*/
|
|
178
|
-
function configExists() {
|
|
179
|
-
return fs.existsSync(getConfigPath()) || fs.existsSync(getLegacyConfigPath());
|
|
180
|
-
}
|
|
181
|
-
//# sourceMappingURL=config.js.map
|
package/dist/lib/config.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../lib/config.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiBA,oCAGC;AAMD,sCAEC;AAMD,kDAEC;AAOD,gCA8CC;AAMD,kCA6BC;AAMD,4CAqBC;AAMD,oCAEC;AA/JD,uCAAyB;AACzB,2CAA6B;AAC7B,uCAAyB;AAWzB;;;GAGG;AACH,SAAgB,YAAY;IAC1B,MAAM,UAAU,GAAG,OAAO,CAAC,GAAG,CAAC,eAAe,IAAI,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,SAAS,CAAC,CAAC;IACrF,OAAO,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,YAAY,CAAC,CAAC;AAC7C,CAAC;AAED;;;GAGG;AACH,SAAgB,aAAa;IAC3B,OAAO,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE,EAAE,aAAa,CAAC,CAAC;AAClD,CAAC;AAED;;;GAGG;AACH,SAAgB,mBAAmB;IACjC,OAAO,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,EA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AC;AACH,CAAC;AAED;;;GAGG;AACH,SAAgB,YAAY;IAC1B,OAAO,EAAE,CAAC,UAAU,CAAC,aAAa,EAAE,CAAC,IAAI,EAAE,CAAC,UAAU,CAAC,mBAAmB,EAAE,CAAC,CAAC;AAChF,CAAC"}
|
package/dist/lib/issues.d.ts
DELETED
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
export interface IssueActionItem {
|
|
2
|
-
id: string;
|
|
3
|
-
issue_id: string;
|
|
4
|
-
title: string;
|
|
5
|
-
description: string | null;
|
|
6
|
-
severity: number;
|
|
7
|
-
is_done: boolean;
|
|
8
|
-
done_by: number | null;
|
|
9
|
-
done_at: string | null;
|
|
10
|
-
created_at: string;
|
|
11
|
-
updated_at: string;
|
|
12
|
-
}
|
|
13
|
-
export interface Issue {
|
|
14
|
-
id: string;
|
|
15
|
-
title: string;
|
|
16
|
-
description: string | null;
|
|
17
|
-
created_at: string;
|
|
18
|
-
updated_at: string;
|
|
19
|
-
status: number;
|
|
20
|
-
url_main: string | null;
|
|
21
|
-
urls_extra: string[] | null;
|
|
22
|
-
data: unknown | null;
|
|
23
|
-
author_id: number;
|
|
24
|
-
org_id: number;
|
|
25
|
-
project_id: number | null;
|
|
26
|
-
is_ai_generated: boolean;
|
|
27
|
-
assigned_to: number[] | null;
|
|
28
|
-
labels: string[] | null;
|
|
29
|
-
is_edited: boolean;
|
|
30
|
-
author_display_name: string;
|
|
31
|
-
comment_count: number;
|
|
32
|
-
action_items: IssueActionItem[];
|
|
33
|
-
}
|
|
34
|
-
export interface IssueComment {
|
|
35
|
-
id: string;
|
|
36
|
-
issue_id: string;
|
|
37
|
-
author_id: number;
|
|
38
|
-
parent_comment_id: string | null;
|
|
39
|
-
content: string;
|
|
40
|
-
created_at: string;
|
|
41
|
-
updated_at: string;
|
|
42
|
-
data: unknown | null;
|
|
43
|
-
}
|
|
44
|
-
export type IssueListItem = Pick<Issue, "id" | "title" | "status" | "created_at">;
|
|
45
|
-
export type IssueDetail = Pick<Issue, "id" | "title" | "description" | "status" | "created_at" | "author_display_name">;
|
|
46
|
-
export interface FetchIssuesParams {
|
|
47
|
-
apiKey: string;
|
|
48
|
-
apiBaseUrl: string;
|
|
49
|
-
debug?: boolean;
|
|
50
|
-
}
|
|
51
|
-
export declare function fetchIssues(params: FetchIssuesParams): Promise<IssueListItem[]>;
|
|
52
|
-
export interface FetchIssueCommentsParams {
|
|
53
|
-
apiKey: string;
|
|
54
|
-
apiBaseUrl: string;
|
|
55
|
-
issueId: string;
|
|
56
|
-
debug?: boolean;
|
|
57
|
-
}
|
|
58
|
-
export declare function fetchIssueComments(params: FetchIssueCommentsParams): Promise<IssueComment[]>;
|
|
59
|
-
export interface FetchIssueParams {
|
|
60
|
-
apiKey: string;
|
|
61
|
-
apiBaseUrl: string;
|
|
62
|
-
issueId: string;
|
|
63
|
-
debug?: boolean;
|
|
64
|
-
}
|
|
65
|
-
export declare function fetchIssue(params: FetchIssueParams): Promise<IssueDetail | null>;
|
|
66
|
-
export interface CreateIssueCommentParams {
|
|
67
|
-
apiKey: string;
|
|
68
|
-
apiBaseUrl: string;
|
|
69
|
-
issueId: string;
|
|
70
|
-
content: string;
|
|
71
|
-
parentCommentId?: string;
|
|
72
|
-
debug?: boolean;
|
|
73
|
-
}
|
|
74
|
-
export declare function createIssueComment(params: CreateIssueCommentParams): Promise<IssueComment>;
|
|
75
|
-
//# sourceMappingURL=issues.d.ts.map
|
package/dist/lib/issues.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"issues.d.ts","sourceRoot":"","sources":["../../lib/issues.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,eAAe;IAC9B,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,OAAO,CAAC;IACjB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